Skip to content

Commit d7d3127

Browse files
authored
Fix JS errors with ECE on the shortcode checkout (#3497)
* Fix JS errors with ECE on the shortcode checkout * Changelog and readme entries
1 parent 470d346 commit d7d3127

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*** Changelog ***
22

33
= 8.8.0 - xxxx-xx-xx =
4+
* Fix - Fixes some JS console errors when making a purchase with the Stripe Express Checkout Element on the shortcode checkout.
45
* Fix - Updates the display logic for the OAuth re-connect promotional surface to follow the latest changes made to the connection settings object.
56
* Fix - Remove unexpected HTML in error message for shortcode checkout.
67
* Fix - Ensure ordering for Stripe payment methods is saved even when setting up from scratch.

client/express-checkout/event-handler.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ export const onConfirmHandler = async (
6262
event,
6363
order = 0 // Order ID for the pay for order flow.
6464
) => {
65-
const { error: submitError } = await elements.submit();
66-
if ( submitError ) {
67-
return abortPayment( event, submitError.message );
65+
const submitResponse = await elements.submit();
66+
if ( submitResponse?.error ) {
67+
return abortPayment( event, submitResponse?.error?.message );
6868
}
6969

7070
const { paymentMethod, error } = await stripe.createPaymentMethod( {

client/express-checkout/utils/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,12 @@ const getRequiredFieldDataFromShortcodeCheckoutForm = ( data ) => {
229229
}
230230

231231
// if shipping same as billing is selected, copy the billing field to shipping field.
232-
const shipToDiffAddress = document
233-
.getElementById( 'ship-to-different-address' )
234-
.querySelector( 'input' ).checked;
232+
const shipToDiffAddressField = document.getElementById(
233+
'ship-to-different-address'
234+
);
235+
const shipToDiffAddress =
236+
shipToDiffAddressField &&
237+
shipToDiffAddressField.querySelector( 'input' ).checked;
235238
if ( ! shipToDiffAddress ) {
236239
const shippingFieldName = name.replace(
237240
'billing_',

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ If you get stuck, you can ask for help in the Plugin Forum.
129129
== Changelog ==
130130

131131
= 8.8.0 - xxxx-xx-xx =
132+
* Fix - Fixes some JS console errors when making a purchase with the Stripe Express Checkout Element on the shortcode checkout.
132133
* Fix - Updates the display logic for the OAuth re-connect promotional surface to follow the latest changes made to the connection settings object.
133134
* Fix - Remove unexpected HTML in error message for shortcode checkout.
134135
* Fix - Ensure ordering for Stripe payment methods is saved even when setting up from scratch.

0 commit comments

Comments
 (0)