From 65b435135b10ccd855dc2ed585ce565eb7f66760 Mon Sep 17 00:00:00 2001 From: Alex P Date: Fri, 5 Aug 2022 17:12:51 +0300 Subject: [PATCH] Revert removal of gateway status check Looks like it was accidentally removed after #704 merge conflict. Without it we always render the hidden area for separate card gateway, so the check in JS fails and we always render all standard buttons separately in checkout, which may result in wrong style and other issues. --- 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 d7dd4c168..364189417 100644 --- a/modules/ppcp-button/src/Assets/SmartButton.php +++ b/modules/ppcp-button/src/Assets/SmartButton.php @@ -559,6 +559,12 @@ class SmartButton implements SmartButtonInterface { return; } + $available_gateways = WC()->payment_gateways->get_available_payment_gateways(); + + if ( ! isset( $available_gateways[ $gateway_id ] ) ) { + return; + } + // The wrapper is needed for the loading spinner, // otherwise jQuery block() prevents buttons rendering. echo '
';