From 11b46d79122387354959c7c65b0b52fe8e6c47f1 Mon Sep 17 00:00:00 2001 From: dinamiko Date: Wed, 7 Sep 2022 15:35:12 +0200 Subject: [PATCH] Get gateway enabled value from gateway object instead of plugin settings --- modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php index 8ecfce40c..ee3492209 100644 --- a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php +++ b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php @@ -88,9 +88,12 @@ class DisableGateways { * @return bool */ private function disable_all_gateways() : bool { - if ( ! $this->settings->has( 'enabled' ) || ! $this->settings->get( 'enabled' ) ) { - return true; + foreach ( WC()->payment_gateways->payment_gateways() as $gateway ) { + if ( PayPalGateway::ID === $gateway->id && $gateway->enabled !== 'yes' ) { + return true; + } } + if ( ! $this->settings->has( 'merchant_email' ) || ! is_email( $this->settings->get( 'merchant_email' ) ) ) { return true; }