From 7cd304ef5d49aee6676a51ae0ffb6761bfed8823 Mon Sep 17 00:00:00 2001 From: Romario Raffington <romarioraff@gmail.com> Date: Tue, 24 Sep 2024 11:42:36 -0500 Subject: [PATCH] Allow the `forceNetworkSavedCards` payment method setting to be overridden (#9460) Co-authored-by: Timur Karimov <timur.karimow.95@gmail.com> --- ...troduce-support-for-wcpay_force_network_saved_cards-filter | 4 ++++ includes/class-wc-payments-checkout.php | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog/fix-reintroduce-support-for-wcpay_force_network_saved_cards-filter diff --git a/changelog/fix-reintroduce-support-for-wcpay_force_network_saved_cards-filter b/changelog/fix-reintroduce-support-for-wcpay_force_network_saved_cards-filter new file mode 100644 index 00000000000..459e9a4d73e --- /dev/null +++ b/changelog/fix-reintroduce-support-for-wcpay_force_network_saved_cards-filter @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Allow the network saved card payment method setting to be overridden by the `wcpay_force_network_saved_cards` filter diff --git a/includes/class-wc-payments-checkout.php b/includes/class-wc-payments-checkout.php index 5764ecd96d5..79e6e119267 100644 --- a/includes/class-wc-payments-checkout.php +++ b/includes/class-wc-payments-checkout.php @@ -332,7 +332,9 @@ public function get_enabled_payment_method_config() { 'number' => '<button type="button" class="js-woopayments-copy-test-number" aria-label="' . esc_attr( __( 'Click to copy the test number to clipboard', 'woocommerce-payments' ) ) . '" title="' . esc_attr( __( 'Copy to clipboard', 'woocommerce-payments' ) ) . '"><i></i><span>', ] ); - $settings[ $payment_method_id ]['forceNetworkSavedCards'] = $gateway_for_payment_method->should_use_stripe_platform_on_checkout_page(); + + $should_enable_network_saved_cards = Payment_Method::CARD === $payment_method_id && WC_Payments::is_network_saved_cards_enabled(); + $settings[ $payment_method_id ]['forceNetworkSavedCards'] = $should_enable_network_saved_cards || $gateway_for_payment_method->should_use_stripe_platform_on_checkout_page(); } return $settings;