mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Merge pull request #765 from woocommerce/pcp-841-card-button-no-paypal
Do not show card button gateway if PayPal gateway disabled
This commit is contained in:
commit
46352ba16e
1 changed files with 7 additions and 2 deletions
|
@ -291,7 +291,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' );
|
||||
|
||||
/**
|
||||
|
@ -303,7 +308,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