Skip to content

Commit a8e04bc

Browse files
authored
Fix duplicate wc_stripe_params enqueued variable (#2253)
* Remove call from payment request * Enqueue UPE payment scripts on product page * Use `wc_stripe_upe_params` locale in PRB * Add locale to `wc_stripe_payment_request_params` * Add changelog entry * Add additional changelog entry
1 parent d82e91a commit a8e04bc

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

assets/js/stripe-payment-request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jQuery( function( $ ) {
33
'use strict';
44

55
var stripe = Stripe( wc_stripe_payment_request_params.stripe.key, {
6-
locale: typeof wc_stripe_params !== 'undefined' ? wc_stripe_params.stripe_locale : 'auto',
6+
locale: wc_stripe_payment_request_params.stripe.locale
77
} ),
88
paymentRequestType;
99

changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* Add - Add ability to test Stripe account keys' validity.
1010
* Fix - Fixed full bank statement field description.
1111
* Fix - Notification messages are placed on top of the account keys modal.
12+
* Fix - Express checkout with 3DS card on product page when new checkout experience is enabled.
13+
* Fix - Remove duplicate call to `payment_scripts`.
1214

1315
= 6.0.0 - 2022-01-05 =
1416
* Fix - Fixed capitalization for payment method names: iDEAL, giropay, and Sofort.

includes/payment-methods/class-wc-stripe-payment-request.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ public function javascript_params() {
708708
'stripe' => [
709709
'key' => $this->publishable_key,
710710
'allow_prepaid_card' => apply_filters( 'wc_stripe_allow_prepaid_card', true ) ? 'yes' : 'no',
711+
'locale' => WC_Stripe_Helper::convert_wc_locale_to_stripe_locale( get_locale() ),
711712
],
712713
'nonce' => [
713714
'payment' => wp_create_nonce( 'wc-stripe-payment-request' ),
@@ -773,11 +774,6 @@ public function scripts() {
773774
);
774775

775776
wp_enqueue_script( 'wc_stripe_payment_request' );
776-
777-
$gateways = WC()->payment_gateways->get_available_payment_gateways();
778-
if ( isset( $gateways['stripe'] ) ) {
779-
$gateways['stripe']->payment_scripts();
780-
}
781777
}
782778

783779
/**

includes/payment-methods/class-wc-stripe-upe-payment-gateway.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,15 @@ public function init_form_fields() {
195195
* Outputs scripts used for stripe payment
196196
*/
197197
public function payment_scripts() {
198-
if ( ! is_cart() && ! is_checkout() && ! isset( $_GET['pay_for_order'] ) && ! is_add_payment_method_page() ) {
198+
if (
199+
! is_product()
200+
&& ! WC_Stripe_Helper::has_cart_or_checkout_on_current_page()
201+
&& ! isset( $_GET['pay_for_order'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
202+
&& ! is_add_payment_method_page() ) {
203+
return;
204+
}
205+
206+
if ( is_product() && ! WC_Stripe_Helper::should_load_scripts_on_product_page() ) {
199207
return;
200208
}
201209

readme.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,7 @@ If you get stuck, you can ask for help in the Plugin Forum.
137137
* Add - Add ability to test Stripe account keys' validity.
138138
* Fix - Fixed full bank statement field description.
139139
* Fix - Notification messages are placed on top of the account keys modal.
140+
* Fix - Express checkout with 3DS card on product page when new checkout experience is enabled.
141+
* Fix - Remove duplicate call to `payment_scripts`.
140142

141143
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).

0 commit comments

Comments
 (0)