From d125c24dc0a0528cd73239602602c32fe2e59d41 Mon Sep 17 00:00:00 2001 From: "Alex P." Date: Fri, 18 Oct 2024 09:03:24 +0300 Subject: [PATCH 1/8] Use basic redirect gateway when checkout smart buttons disabled --- .../resources/js/checkout-block.js | 14 ++++++------- .../ppcp-blocks/src/PayPalPaymentMethod.php | 10 ++++++---- modules/ppcp-button/services.php | 20 +++++++++++++------ .../src/Checkout/DisableGateways.php | 3 --- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/modules/ppcp-blocks/resources/js/checkout-block.js b/modules/ppcp-blocks/resources/js/checkout-block.js index 97590838e..47b2dba05 100644 --- a/modules/ppcp-blocks/resources/js/checkout-block.js +++ b/modules/ppcp-blocks/resources/js/checkout-block.js @@ -739,11 +739,11 @@ if ( cartHasSubscriptionProducts( config.scriptData ) ) { features.push( 'subscriptions' ); } -if ( block_enabled && config.enabled ) { - if ( - ( config.addPlaceOrderMethod || config.usePlaceOrder ) && - ! config.scriptData.continuation - ) { +if ( + block_enabled && + ( config.smartButtonsEnabled || config.placeOrderEnabled ) +) { + if ( config.placeOrderEnabled && ! config.scriptData.continuation ) { let descriptionElement = (
{ - return config.enabled; + return true; }, supports: { features, @@ -798,7 +798,7 @@ if ( block_enabled && config.enabled ) { features: [ ...features, 'ppcp_continuation' ], }, } ); - } else if ( ! config.usePlaceOrder ) { + } else if ( config.smartButtonsEnabled ) { for ( const fundingSource of [ 'paypal', ...config.enabledFundingSources, diff --git a/modules/ppcp-blocks/src/PayPalPaymentMethod.php b/modules/ppcp-blocks/src/PayPalPaymentMethod.php index 50340b574..4afd294da 100644 --- a/modules/ppcp-blocks/src/PayPalPaymentMethod.php +++ b/modules/ppcp-blocks/src/PayPalPaymentMethod.php @@ -195,9 +195,7 @@ class PayPalPaymentMethod extends AbstractPaymentMethodType { // Do not load when definitely not needed, // but we still need to check the locations later and handle in JS // because has_block cannot be called here (too early). - return $this->plugin_settings->has( 'enabled' ) && $this->plugin_settings->get( 'enabled' ) - && ( $this->settings_status->is_smart_button_enabled_for_location( 'checkout-block-express' ) || - $this->settings_status->is_smart_button_enabled_for_location( 'cart-block' ) ); + return $this->plugin_settings->has( 'enabled' ) && $this->plugin_settings->get( 'enabled' ); } /** @@ -245,11 +243,15 @@ class PayPalPaymentMethod extends AbstractPaymentMethodType { ); } + $smart_buttons_enabled = ! $this->use_place_order && $this->settings_status->is_smart_button_enabled_for_location( $script_data['context'] ?? 'block-checkout' ); + $place_order_enabled = $this->use_place_order || $this->add_place_order_method; + return array( 'id' => $this->gateway->id, 'title' => $this->gateway->title, 'description' => $this->gateway->description, - 'enabled' => $this->settings_status->is_smart_button_enabled_for_location( $script_data['context'] ?? 'checkout' ), + 'smartButtonsEnabled' => $smart_buttons_enabled, + 'placeOrderEnabled' => $place_order_enabled, 'fundingSource' => $this->session_handler->funding_source(), 'finalReviewEnabled' => $this->final_review_enabled, 'addPlaceOrderMethod' => $this->add_place_order_method, diff --git a/modules/ppcp-button/services.php b/modules/ppcp-button/services.php index 09783f436..5cd0c85e1 100644 --- a/modules/ppcp-button/services.php +++ b/modules/ppcp-button/services.php @@ -37,6 +37,7 @@ use WooCommerce\PayPalCommerce\Button\Helper\MessagesApply; use WooCommerce\PayPalCommerce\Button\Helper\ThreeDSecure; use WooCommerce\PayPalCommerce\Onboarding\Environment; use WooCommerce\PayPalCommerce\Onboarding\State; +use WooCommerce\PayPalCommerce\WcGateway\Helper\SettingsStatus; return array( 'button.client_id' => static function ( ContainerInterface $container ): string { @@ -101,12 +102,20 @@ return array( return $obj->get_context(); }, 'button.smart-button' => static function ( ContainerInterface $container ): SmartButtonInterface { - $state = $container->get( 'onboarding.state' ); - if ( $container->get( 'wcgateway.use-place-order-button' ) - && in_array( $container->get( 'button.context' ), array( 'checkout', 'pay-now' ), true ) - ) { - return new DisabledSmartButton(); + $context = $container->get( 'button.context' ); + + $settings_status = $container->get( 'wcgateway.settings.status' ); + assert( $settings_status instanceof SettingsStatus ); + + if ( in_array( $context, array( 'checkout', 'pay-now' ), true ) ) { + if ( $container->get( 'wcgateway.use-place-order-button' ) + || ! $settings_status->is_smart_button_enabled_for_location( $context ) + ) { + return new DisabledSmartButton(); + } } + + $state = $container->get( 'onboarding.state' ); if ( $state->current_state() !== State::STATE_ONBOARDED ) { return new DisabledSmartButton(); } @@ -125,7 +134,6 @@ return array( $messages_apply = $container->get( 'button.helper.messages-apply' ); $environment = $container->get( 'onboarding.environment' ); $payment_token_repository = $container->get( 'vaulting.repository.payment-token' ); - $settings_status = $container->get( 'wcgateway.settings.status' ); return new SmartButton( $container->get( 'button.url' ), $container->get( 'ppcp.asset-version' ), diff --git a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php index a55fe621c..2760271fd 100644 --- a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php +++ b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php @@ -97,9 +97,6 @@ class DisableGateways { if ( ! $this->settings_status->is_smart_button_enabled_for_location( 'checkout' ) ) { unset( $methods[ CardButtonGateway::ID ] ); - if ( ! $this->session_handler->order() && is_checkout() ) { - unset( $methods[ PayPalGateway::ID ] ); - } } if ( ! $this->needs_to_disable_gateways() ) { From 7b93bc65192277d6c73fa6d227e48c172656fd54 Mon Sep 17 00:00:00 2001 From: Alex P Date: Fri, 18 Oct 2024 09:10:15 +0300 Subject: [PATCH 2/8] Update text --- modules/ppcp-onboarding/src/Assets/OnboardingAssets.php | 2 +- modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php | 2 +- .../src/Settings/Fields/paypal-smart-button-fields.php | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php b/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php index c5385216d..663bdfee1 100644 --- a/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php +++ b/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php @@ -117,7 +117,7 @@ class OnboardingAssets { array( 'empty_smart_button_location_message' => sprintf( '

%1$s

', - __( 'Note: If no button location is selected, the PayPal gateway will not be available.', 'woocommerce-paypal-payments' ) + __( 'Note: PayPal buttons and advanced payment features (Alternative Payment Methods, Subscriptions, etc.) are unavailable if no Smart Button Location is configured.', 'woocommerce-paypal-payments' ) ), ) ); diff --git a/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php b/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php index 4a00b8d5e..2006ee1fa 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php +++ b/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php @@ -356,7 +356,7 @@ class PayPalGateway extends \WC_Payment_Gateway { 'type' => 'checkbox', 'desc_tip' => true, 'description' => __( 'In order to use PayPal or Advanced Card Processing, you need to enable the Gateway.', 'woocommerce-paypal-payments' ), - 'label' => __( 'Enable PayPal features for your store', 'woocommerce-paypal-payments' ), + 'label' => __( 'Enable the PayPal gateway and more features for your store.', 'woocommerce-paypal-payments' ), 'default' => 'no', ), 'ppcp' => array( diff --git a/modules/ppcp-wc-gateway/src/Settings/Fields/paypal-smart-button-fields.php b/modules/ppcp-wc-gateway/src/Settings/Fields/paypal-smart-button-fields.php index 011cfd192..18f7cdc48 100644 --- a/modules/ppcp-wc-gateway/src/Settings/Fields/paypal-smart-button-fields.php +++ b/modules/ppcp-wc-gateway/src/Settings/Fields/paypal-smart-button-fields.php @@ -226,14 +226,11 @@ return function ( ContainerInterface $container, array $fields ): array { 'description' => sprintf( // translators: %1$s and %2$s are the opening and closing of HTML tag. __( - 'Customize the appearance of the PayPal smart buttons on the %1$sClassic Checkout page%2$s. - %3$sCheckout Buttons must be enabled to display the PayPal gateway on the Checkout page. - ', + 'Customize the appearance of the PayPal smart buttons on the %1$sClassic Checkout page%2$s.', 'woocommerce-paypal-payments' ), '', - '', - '
' + '' ), 'type' => 'ppcp-heading', 'screens' => array( From 20a627aebb1acac753161e7ab27314242290443a Mon Sep 17 00:00:00 2001 From: "Alex P." Date: Fri, 18 Oct 2024 09:34:39 +0300 Subject: [PATCH 3/8] Refactor/cleanup --- .../ppcp-onboarding/resources/js/settings.js | 67 ++++++++++--------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/modules/ppcp-onboarding/resources/js/settings.js b/modules/ppcp-onboarding/resources/js/settings.js index 1afc1890b..a915d48cd 100644 --- a/modules/ppcp-onboarding/resources/js/settings.js +++ b/modules/ppcp-onboarding/resources/js/settings.js @@ -1,3 +1,8 @@ +import { + setVisible, + setVisibleByClass, +} from '../../../ppcp-button/resources/js/modules/Helper/Hiding'; + document.addEventListener( 'DOMContentLoaded', () => { const payLaterMessagingSelectableLocations = [ 'product', @@ -216,6 +221,18 @@ document.addEventListener( 'DOMContentLoaded', () => { replace(); }; + const hideElements = ( selectorGroup ) => { + selectorGroup.forEach( ( selector ) => + setVisibleByClass( selector, false, 'hide' ) + ); + }; + + const showElements = ( selectorGroup ) => { + selectorGroup.forEach( ( selector ) => + setVisibleByClass( selector, true, 'hide' ) + ); + }; + const toggleInputsBySelectedLocations = ( stylingPerSelector, locationsSelector, @@ -226,30 +243,30 @@ document.addEventListener( 'DOMContentLoaded', () => { const payLaterMessagingEnabled = document.querySelector( payLaterMessagingEnabledSelector ); - const stylingPerElement = document.querySelector( stylingPerSelector ); - const locationsElement = document.querySelector( locationsSelector ); - const stylingPerElementWrapper = stylingPerElement?.closest( 'tr' ); - const stylingPerElementWrapperSelector = - '#' + stylingPerElementWrapper?.getAttribute( 'id' ); + const stylingPerElement = document.querySelector( stylingPerSelector ); if ( ! stylingPerElement ) { return; } + const stylingPerElementWrapper = stylingPerElement.closest( 'tr' ); + const toggleElementsBySelectedLocations = () => { - stylingPerElementWrapper.style.display = ''; const selectedLocations = getSelectedLocations( locationsSelector ); - const emptySmartButtonLocationMessage = jQuery( - '.ppcp-empty-smart-button-location' + + setVisibleByClass( + stylingPerElementWrapper, + selectedLocations.length > 0, + 'hide' ); if ( selectedLocations.length === 0 ) { - hideElements( - groupToHideOnChecked.concat( - stylingPerElementWrapperSelector - ) + hideElements( groupToHideOnChecked ); + + const emptySmartButtonLocationMessage = document.querySelector( + '.ppcp-empty-smart-button-location' ); - if ( emptySmartButtonLocationMessage.length === 0 ) { + if ( ! emptySmartButtonLocationMessage ) { jQuery( PayPalCommerceSettings.empty_smart_button_location_message ).insertAfter( @@ -277,11 +294,11 @@ document.addEventListener( 'DOMContentLoaded', () => { ); groupToShowOnChecked.forEach( ( element ) => { - if ( inputSelectors.includes( element ) ) { - document.querySelector( element ).style.display = ''; - return; - } - document.querySelector( element ).style.display = 'none'; + setVisibleByClass( + element, + inputSelectors.includes( element ), + 'hide' + ); } ); if ( inputType === 'messages' ) { @@ -289,18 +306,6 @@ document.addEventListener( 'DOMContentLoaded', () => { } }; - const hideElements = ( selectroGroup ) => { - selectroGroup.forEach( ( elementToHide ) => { - document.querySelector( elementToHide ).style.display = 'none'; - } ); - }; - - const showElements = ( selectroGroup ) => { - selectroGroup.forEach( ( elementToShow ) => { - document.querySelector( elementToShow ).style.display = ''; - } ); - }; - groupToggle( stylingPerSelector, groupToShowOnChecked ); toggleElementsBySelectedLocations(); @@ -327,7 +332,7 @@ document.addEventListener( 'DOMContentLoaded', () => { } ); // We need to use jQuery here as the select might be a select2 element, which doesn't use native events. - jQuery( locationsElement ).on( 'change', function () { + jQuery( locationsSelector ).on( 'change', function () { const emptySmartButtonLocationMessage = jQuery( '.ppcp-empty-smart-button-location' ); From 21e0cf3c1d54efc266ff50383413dcd092250112 Mon Sep 17 00:00:00 2001 From: "Alex P." Date: Fri, 18 Oct 2024 17:04:41 +0300 Subject: [PATCH 4/8] Do not allow basic redirect gateway for subscriptions --- modules/ppcp-blocks/services.php | 1 + modules/ppcp-blocks/src/PayPalPaymentMethod.php | 17 +++++++++++++++-- .../src/Checkout/DisableGateways.php | 3 +++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/modules/ppcp-blocks/services.php b/modules/ppcp-blocks/services.php index 4f2bba04c..e4226ca2a 100644 --- a/modules/ppcp-blocks/services.php +++ b/modules/ppcp-blocks/services.php @@ -47,6 +47,7 @@ return array( $container->get( 'blocks.settings.final_review_enabled' ), $container->get( 'session.cancellation.view' ), $container->get( 'session.handler' ), + $container->get( 'wc-subscriptions.helper' ), $container->get( 'blocks.add-place-order-method' ), $container->get( 'wcgateway.use-place-order-button' ), $container->get( 'wcgateway.place-order-button-text' ), diff --git a/modules/ppcp-blocks/src/PayPalPaymentMethod.php b/modules/ppcp-blocks/src/PayPalPaymentMethod.php index 4afd294da..71242e917 100644 --- a/modules/ppcp-blocks/src/PayPalPaymentMethod.php +++ b/modules/ppcp-blocks/src/PayPalPaymentMethod.php @@ -19,6 +19,7 @@ use WooCommerce\PayPalCommerce\Session\SessionHandler; use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway; use WooCommerce\PayPalCommerce\WcGateway\Helper\SettingsStatus; use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings; +use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper; /** * Class PayPalPaymentMethod @@ -87,6 +88,13 @@ class PayPalPaymentMethod extends AbstractPaymentMethodType { */ private $session_handler; + /** + * The Subscription Helper. + * + * @var SubscriptionHelper + */ + private $subscription_helper; + /** * Whether to create a non-express method with the standard "Place order" button. * @@ -141,6 +149,7 @@ class PayPalPaymentMethod extends AbstractPaymentMethodType { * @param bool $final_review_enabled Whether the final review is enabled. * @param CancelView $cancellation_view The cancellation view. * @param SessionHandler $session_handler The Session handler. + * @param SubscriptionHelper $subscription_helper The subscription helper. * @param bool $add_place_order_method Whether to create a non-express method with the standard "Place order" button. * @param bool $use_place_order Whether to use the standard "Place order" button instead of PayPal buttons. * @param string $place_order_button_text The text for the standard "Place order" button. @@ -158,6 +167,7 @@ class PayPalPaymentMethod extends AbstractPaymentMethodType { bool $final_review_enabled, CancelView $cancellation_view, SessionHandler $session_handler, + SubscriptionHelper $subscription_helper, bool $add_place_order_method, bool $use_place_order, string $place_order_button_text, @@ -175,6 +185,7 @@ class PayPalPaymentMethod extends AbstractPaymentMethodType { $this->final_review_enabled = $final_review_enabled; $this->cancellation_view = $cancellation_view; $this->session_handler = $session_handler; + $this->subscription_helper = $subscription_helper; $this->add_place_order_method = $add_place_order_method; $this->use_place_order = $use_place_order; $this->place_order_button_text = $place_order_button_text; @@ -243,8 +254,10 @@ class PayPalPaymentMethod extends AbstractPaymentMethodType { ); } - $smart_buttons_enabled = ! $this->use_place_order && $this->settings_status->is_smart_button_enabled_for_location( $script_data['context'] ?? 'block-checkout' ); - $place_order_enabled = $this->use_place_order || $this->add_place_order_method; + $smart_buttons_enabled = ! $this->use_place_order + && $this->settings_status->is_smart_button_enabled_for_location( $script_data['context'] ?? 'block-checkout' ); + $place_order_enabled = ( $this->use_place_order || $this->add_place_order_method ) + && ! $this->subscription_helper->cart_contains_subscription(); return array( 'id' => $this->gateway->id, diff --git a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php index 2760271fd..9c991c98b 100644 --- a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php +++ b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php @@ -97,6 +97,9 @@ class DisableGateways { if ( ! $this->settings_status->is_smart_button_enabled_for_location( 'checkout' ) ) { unset( $methods[ CardButtonGateway::ID ] ); + if ( $this->subscription_helper->cart_contains_subscription() ) { + unset( $methods[ PayPalGateway::ID ] ); + } } if ( ! $this->needs_to_disable_gateways() ) { From 74b560c33c290bba268cb8e8bcde4b222a7f4d33 Mon Sep 17 00:00:00 2001 From: "Alex P." Date: Fri, 18 Oct 2024 20:26:18 +0300 Subject: [PATCH 5/8] Hide subscription settings when checkout smart buttons disabled --- .../ppcp-onboarding/resources/js/settings.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/modules/ppcp-onboarding/resources/js/settings.js b/modules/ppcp-onboarding/resources/js/settings.js index a915d48cd..46862e390 100644 --- a/modules/ppcp-onboarding/resources/js/settings.js +++ b/modules/ppcp-onboarding/resources/js/settings.js @@ -462,6 +462,38 @@ document.addEventListener( 'DOMContentLoaded', () => { } }; + /** + * Hide the subscription settings when smart buttons are disabled for checkout, + * since the basic redirect gateway is disabled for subscriptions. + */ + const initSettingsHidingForPlaceOrderGateway = () => { + const selectors = [ + '#field-paypal_saved_payments', + '#field-subscriptions_mode', + '#field-vault_enabled', + ]; + + const updateSettingsVisibility = () => { + const selectedLocations = getSelectedLocations( + smartButtonLocationsSelect + ); + const hasCheckoutSmartButtons = + selectedLocations.includes( 'checkout' ) || + selectedLocations.includes( 'checkout-block-express' ); + + selectors.forEach( ( selector ) => { + setVisibleByClass( selector, hasCheckoutSmartButtons, 'hide' ); + } ); + }; + + updateSettingsVisibility(); + + jQuery( smartButtonLocationsSelect ).on( + 'change', + updateSettingsVisibility + ); + }; + ( () => { removeDisabledCardIcons( 'select[name="ppcp[disable_cards][]"]', @@ -493,6 +525,8 @@ document.addEventListener( 'DOMContentLoaded', () => { toggleMessagingEnabled(); + initSettingsHidingForPlaceOrderGateway(); + groupToggle( '#ppcp-vault_enabled', [ '#field-subscription_behavior_when_vault_fails', ] ); From 18bd00c697e0c2ae828f032a206b8dcead3e9544 Mon Sep 17 00:00:00 2001 From: "Alex P." Date: Sat, 19 Oct 2024 11:21:26 +0300 Subject: [PATCH 6/8] Fix block conditions --- modules/ppcp-blocks/resources/js/checkout-block.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/ppcp-blocks/resources/js/checkout-block.js b/modules/ppcp-blocks/resources/js/checkout-block.js index 47b2dba05..89ec756be 100644 --- a/modules/ppcp-blocks/resources/js/checkout-block.js +++ b/modules/ppcp-blocks/resources/js/checkout-block.js @@ -739,11 +739,8 @@ if ( cartHasSubscriptionProducts( config.scriptData ) ) { features.push( 'subscriptions' ); } -if ( - block_enabled && - ( config.smartButtonsEnabled || config.placeOrderEnabled ) -) { - if ( config.placeOrderEnabled && ! config.scriptData.continuation ) { +if ( block_enabled ) { + if ( (config.placeOrderEnabled || config.usePlaceOrder) && ! config.scriptData.continuation ) { let descriptionElement = (
Date: Mon, 21 Oct 2024 17:34:41 +0300 Subject: [PATCH 7/8] Remove unused --- modules/ppcp-blocks/resources/js/checkout-block.js | 2 +- modules/ppcp-blocks/src/PayPalPaymentMethod.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/ppcp-blocks/resources/js/checkout-block.js b/modules/ppcp-blocks/resources/js/checkout-block.js index 89ec756be..6dcd7689c 100644 --- a/modules/ppcp-blocks/resources/js/checkout-block.js +++ b/modules/ppcp-blocks/resources/js/checkout-block.js @@ -740,7 +740,7 @@ if ( cartHasSubscriptionProducts( config.scriptData ) ) { } if ( block_enabled ) { - if ( (config.placeOrderEnabled || config.usePlaceOrder) && ! config.scriptData.continuation ) { + if ( config.placeOrderEnabled && ! config.scriptData.continuation ) { let descriptionElement = (
$place_order_enabled, 'fundingSource' => $this->session_handler->funding_source(), 'finalReviewEnabled' => $this->final_review_enabled, - 'addPlaceOrderMethod' => $this->add_place_order_method, - 'usePlaceOrder' => $this->use_place_order, 'placeOrderButtonText' => $this->place_order_button_text, 'placeOrderButtonDescription' => $this->place_order_button_description, 'enabledFundingSources' => $funding_sources, From faeee86ab3572db94f014df2faae808b3a96359b Mon Sep 17 00:00:00 2001 From: "Alex P." Date: Mon, 21 Oct 2024 17:38:55 +0300 Subject: [PATCH 8/8] Fix apple/google pay block --- modules/ppcp-applepay/src/Assets/BlocksPaymentMethod.php | 2 +- modules/ppcp-googlepay/src/Assets/BlocksPaymentMethod.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ppcp-applepay/src/Assets/BlocksPaymentMethod.php b/modules/ppcp-applepay/src/Assets/BlocksPaymentMethod.php index 2266f4c73..79a9efe9e 100644 --- a/modules/ppcp-applepay/src/Assets/BlocksPaymentMethod.php +++ b/modules/ppcp-applepay/src/Assets/BlocksPaymentMethod.php @@ -113,7 +113,7 @@ class BlocksPaymentMethod extends AbstractPaymentMethodType { 'id' => $this->name, 'title' => $paypal_data['title'], // TODO : see if we should use another. 'description' => $paypal_data['description'], // TODO : see if we should use another. - 'enabled' => $paypal_data['enabled'], // This button is enabled when PayPal buttons are. + 'enabled' => $paypal_data['smartButtonsEnabled'], // This button is enabled when PayPal buttons are. 'scriptData' => $script_data, ); } diff --git a/modules/ppcp-googlepay/src/Assets/BlocksPaymentMethod.php b/modules/ppcp-googlepay/src/Assets/BlocksPaymentMethod.php index 0f9ff871b..a8dd8f9c4 100644 --- a/modules/ppcp-googlepay/src/Assets/BlocksPaymentMethod.php +++ b/modules/ppcp-googlepay/src/Assets/BlocksPaymentMethod.php @@ -107,7 +107,7 @@ class BlocksPaymentMethod extends AbstractPaymentMethodType { 'id' => $this->name, 'title' => $paypal_data['title'], // See if we should use another. 'description' => $paypal_data['description'], // See if we should use another. - 'enabled' => $paypal_data['enabled'], // This button is enabled when PayPal buttons are. + 'enabled' => $paypal_data['smartButtonsEnabled'], // This button is enabled when PayPal buttons are. 'scriptData' => $this->button->script_data(), ); }