Merge pull request #831 from woocommerce/gateway-enabled-from-gateway

Get gateway enabled value from gateway object instead of plugin settings
This commit is contained in:
Emili Castells 2022-09-07 16:06:50 +02:00 committed by GitHub
commit 9533528c5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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