From 28bed83598ec1298c22659dc6529aa44d09e3d59 Mon Sep 17 00:00:00 2001 From: mattallan Date: Tue, 22 Feb 2022 16:07:24 +1000 Subject: [PATCH] Check if PayPal Payments is available before renderering the buttons --- modules/ppcp-button/src/Assets/SmartButton.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/ppcp-button/src/Assets/SmartButton.php b/modules/ppcp-button/src/Assets/SmartButton.php index 667560dbc..336c5ee89 100644 --- a/modules/ppcp-button/src/Assets/SmartButton.php +++ b/modules/ppcp-button/src/Assets/SmartButton.php @@ -442,6 +442,12 @@ class SmartButton implements SmartButtonInterface { return; } + $available_gateways = WC()->payment_gateways->get_available_payment_gateways(); + + if ( ! isset( $available_gateways['ppcp-gateway'] ) ) { + return; + } + echo '
'; }