diff --git a/modules/ppcp-settings/resources/js/Components/Screens/Settings/Tabs/TabPaymentMethods.js b/modules/ppcp-settings/resources/js/Components/Screens/Settings/Tabs/TabPaymentMethods.js
index 48da574f0..fe4cffe69 100644
--- a/modules/ppcp-settings/resources/js/Components/Screens/Settings/Tabs/TabPaymentMethods.js
+++ b/modules/ppcp-settings/resources/js/Components/Screens/Settings/Tabs/TabPaymentMethods.js
@@ -3,7 +3,7 @@ import { useCallback } from '@wordpress/element';
import SettingsCard from '../../../ReusableComponents/SettingsCard';
import { PaymentMethodsBlock } from '../../../ReusableComponents/SettingsBlocks';
-import { PaymentHooks } from '../../../../data';
+import { CommonHooks, OnboardingHooks, PaymentHooks } from '../../../../data';
import { useActiveModal } from '../../../../data/common/hooks';
import Modal from '../Components/Payment/Modal';
@@ -45,6 +45,9 @@ const TabPaymentMethods = () => {
[ changePaymentSettings, setActiveModal, setPersistent ]
);
+ const merchant = CommonHooks.useMerchant();
+ const { canUseCardPayments } = OnboardingHooks.useFlags();
+
return (
{
methods={ methods.paypal }
onTriggerModal={ setActiveModal }
/>
-
+ { merchant.isBusinessSeller && canUseCardPayments && (
+
+ ) }
get( 'api.helpers.dccapplies' );
assert( $dcc_applies instanceof DCCApplies );
- // Unset BCDC if merchant is eligible for ACDC.
- if ( $dcc_product_status->is_active() && ! $container->get( 'wcgateway.settings.allow_card_button_gateway' ) ) {
+ // Unset BCDC if merchant is eligible for ACDC and country is eligible for card fields.
+ $card_fields_eligible = $container->get( 'card-fields.eligible' );
+ if ( $dcc_product_status->is_active() && $card_fields_eligible ) {
unset( $payment_methods[ CardButtonGateway::ID ] );
}
@@ -366,6 +367,9 @@ class SettingsModule implements ServiceModule, ExecutableModule {
return $methods;
}
+ $card_button_gateway = $container->get( 'wcgateway.card-button-gateway' );
+ assert( $card_button_gateway instanceof CardButtonGateway );
+
$googlepay_gateway = $container->get( 'googlepay.wc-gateway' );
assert( $googlepay_gateway instanceof WC_Payment_Gateway );
@@ -375,6 +379,7 @@ class SettingsModule implements ServiceModule, ExecutableModule {
$axo_gateway = $container->get( 'axo.gateway' );
assert( $axo_gateway instanceof WC_Payment_Gateway );
+ $methods[] = $card_button_gateway;
$methods[] = $googlepay_gateway;
$methods[] = $applepay_gateway;
$methods[] = $axo_gateway;
@@ -400,6 +405,8 @@ class SettingsModule implements ServiceModule, ExecutableModule {
2
);
+ add_filter( 'woocommerce_paypal_payments_card_button_gateway_should_register_gateway', '__return_true' );
+
add_filter(
'woocommerce_paypal_payments_credit_card_gateway_form_fields',
function( array $form_fields ) {
diff --git a/modules/ppcp-wc-gateway/src/WCGatewayModule.php b/modules/ppcp-wc-gateway/src/WCGatewayModule.php
index f8b54f534..6606380b8 100644
--- a/modules/ppcp-wc-gateway/src/WCGatewayModule.php
+++ b/modules/ppcp-wc-gateway/src/WCGatewayModule.php
@@ -648,7 +648,7 @@ class WCGatewayModule implements ServiceModule, ExtendingModule, ExecutableModul
$methods[] = $container->get( 'wcgateway.credit-card-gateway' );
}
- if ( $paypal_gateway_enabled && $container->get( 'wcgateway.settings.allow_card_button_gateway' ) ) {
+ if ( $paypal_gateway_enabled && apply_filters( 'woocommerce_paypal_payments_card_button_gateway_should_register_gateway', $container->get( 'wcgateway.settings.allow_card_button_gateway' ) ) ) {
$methods[] = $container->get( 'wcgateway.card-button-gateway' );
}