Ensure WC()->payment_gateways is not null

This commit is contained in:
emilicastells 2023-01-18 14:39:27 +01:00
parent e383759e20
commit 055ffa9370
No known key found for this signature in database
GPG key ID: 1520C07081754570

View file

@ -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;