From cc1365d5e90c81656a9b3a35fcaf273ed2845788 Mon Sep 17 00:00:00 2001 From: David Remer Date: Mon, 28 Sep 2020 14:10:39 +0300 Subject: [PATCH] disable gateways when gateway setting 'enabled' is false --- .../ppcp-wc-gateway/src/Checkout/class-disablegateways.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/ppcp-wc-gateway/src/Checkout/class-disablegateways.php b/modules/ppcp-wc-gateway/src/Checkout/class-disablegateways.php index bc4064868..d5f291a37 100644 --- a/modules/ppcp-wc-gateway/src/Checkout/class-disablegateways.php +++ b/modules/ppcp-wc-gateway/src/Checkout/class-disablegateways.php @@ -60,6 +60,12 @@ class DisableGateways { if ( ! isset( $methods[ PayPalGateway::ID ] ) && ! isset( $methods[ CreditCardGateway::ID ] ) ) { return $methods; } + if ( ! $this->settings->has( 'enabled' ) || ! $this->settings->get( 'enabled' ) ) { + + unset( $methods[ PayPalGateway::ID ] ); + unset( $methods[ CreditCardGateway::ID ] ); + return $methods; + } if ( ! $this->settings->has( 'merchant_email' ) || ! is_email( $this->settings->get( 'merchant_email' ) )