Skip to content

Commit

Permalink
Add filter to register standrard card button gateway programmatically
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinamiko committed Jan 24, 2025
1 parent 47e8fec commit b08c6f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/ppcp-settings/src/SettingsModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ function( array $payment_methods ) use ( $container ) : array {
assert( $dcc_applies instanceof DCCApplies );

// Unset BCDC if merchant is eligible for ACDC.
if ( $dcc_product_status->dcc_is_active() ) {
if ( $dcc_product_status->dcc_is_active() && ! $container->get( 'wcgateway.settings.allow_card_button_gateway' ) ) {
unset( $payment_methods[ CardButtonGateway::ID ] );
}

Expand Down
7 changes: 5 additions & 2 deletions modules/ppcp-wc-gateway/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -1659,9 +1659,12 @@ static function ( ContainerInterface $container ): string {
$settings = $container->get( 'wcgateway.settings' );
assert( $settings instanceof ContainerInterface );

return $settings->has( 'allow_card_button_gateway' ) ?
return apply_filters(
'woocommerce_paypal_payments_enable_standard_card_button_gateway_settings',
$settings->has( 'allow_card_button_gateway' ) ?
(bool) $settings->get( 'allow_card_button_gateway' ) :
$container->get( 'wcgateway.settings.allow_card_button_gateway.default' );
$container->get( 'wcgateway.settings.allow_card_button_gateway.default' )
);
},
'wcgateway.settings.has_enabled_separate_button_gateways' => static function ( ContainerInterface $container ): bool {
return (bool) $container->get( 'wcgateway.settings.allow_card_button_gateway' );
Expand Down

0 comments on commit b08c6f6

Please sign in to comment.