mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Do not show card button gateway if paypal gateway disabled
This commit is contained in:
parent
f256134148
commit
40365c5afb
1 changed files with 7 additions and 2 deletions
|
@ -292,7 +292,12 @@ class WCGatewayModule implements ModuleInterface {
|
|||
add_filter(
|
||||
'woocommerce_payment_gateways',
|
||||
static function ( $methods ) use ( $container ): array {
|
||||
$methods[] = $container->get( 'wcgateway.paypal-gateway' );
|
||||
$paypal_gateway = $container->get( 'wcgateway.paypal-gateway' );
|
||||
assert( $paypal_gateway instanceof \WC_Payment_Gateway );
|
||||
|
||||
$paypal_gateway_enabled = wc_string_to_bool( $paypal_gateway->get_option( 'enabled' ) );
|
||||
|
||||
$methods[] = $paypal_gateway;
|
||||
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
|
||||
|
||||
/**
|
||||
|
@ -304,7 +309,7 @@ class WCGatewayModule implements ModuleInterface {
|
|||
$methods[] = $container->get( 'wcgateway.credit-card-gateway' );
|
||||
}
|
||||
|
||||
if ( $container->get( 'wcgateway.settings.allow_card_button_gateway' ) ) {
|
||||
if ( $paypal_gateway_enabled && $container->get( 'wcgateway.settings.allow_card_button_gateway' ) ) {
|
||||
$methods[] = $container->get( 'wcgateway.card-button-gateway' );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue