diff --git a/changelog.txt b/changelog.txt index 66dc6830a..39ecc5aa1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ * Fix - Do not call PayPal get order by ID if it does not exist #1029 * Fix - Type check error conflict with German Market #1056 * Fix - Backend Storage for the PayPalRequestIdRepository does not scale #983 +* Fix - Ensure WC()->payment_gateways is not null #1128 * Enhancement - Remove plugin data after uninstalling #1075 * Enhancement - Add FraudNet to all payments #1040 * Enhancement - Update "Standard Payments" tab settings #1065 diff --git a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php index ad60cb9fb..bbd9b30d3 100644 --- a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php +++ b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php @@ -99,6 +99,10 @@ class DisableGateways { * @return bool */ private function disable_all_gateways() : bool { + if ( is_null( WC()->payment_gateways ) ) { + return false; + } + foreach ( WC()->payment_gateways->payment_gateways() as $gateway ) { if ( PayPalGateway::ID === $gateway->id && $gateway->enabled !== 'yes' ) { return true; diff --git a/readme.txt b/readme.txt index eda478f81..c2a417e3e 100644 --- a/readme.txt +++ b/readme.txt @@ -85,6 +85,7 @@ Follow the steps below to connect the plugin to your PayPal account: * Fix - Do not call PayPal get order by ID if it does not exist #1029 * Fix - Type check error conflict with German Market #1056 * Fix - Backend Storage for the PayPalRequestIdRepository does not scale #983 +* Fix - Ensure WC()->payment_gateways is not null #1128 * Enhancement - Remove plugin data after uninstalling #1075 * Enhancement - Add FraudNet to all payments #1040 * Enhancement - Update "Standard Payments" tab settings #1065