Skip to content

Commit

Permalink
Merge branch 'develop' into fix/9987-filter-csv-disputes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagesh Pai committed Dec 18, 2024
2 parents cc5bf3b + 99db1fb commit a13aa52
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelog/fix-tokenized-cart-multiple-variations
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: fix: tokenized cart & multiple variations.


17 changes: 16 additions & 1 deletion client/tokenized-express-checkout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,21 @@ jQuery( ( $ ) => {
'wcpay.express-checkout.update-button-data',
'automattic/wcpay/express-checkout',
async () => {
// if the product cannot be added to cart (because of missing variation selection, etc),
// don't try to add it to the cart to get new data - the call will likely fail.
if (
getExpressCheckoutData( 'button_context' ) === 'product'
) {
const addToCartButton = $(
'.single_add_to_cart_button'
);

// First check if product can be added to cart.
if ( addToCartButton.is( '.disabled' ) ) {
return;
}
}

try {
expressCheckoutButtonUi.blockButton();

Expand Down Expand Up @@ -375,7 +390,7 @@ jQuery( ( $ ) => {

expressCheckoutButtonUi.unblockButton();
} catch ( e ) {
expressCheckoutButtonUi.hide();
expressCheckoutButtonUi.hideContainer();
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const transformCartDataForDisplayItems = ( cartData ) => {
* @return {{id: string, label: string, amount: integer, deliveryEstimate: string}} `shippingRates` for Stripe.
*/
export const transformCartDataForShippingRates = ( cartData ) =>
cartData.shipping_rates?.[ 0 ].shipping_rates
cartData.shipping_rates?.[ 0 ]?.shipping_rates
.sort( ( rateA, rateB ) => {
if ( rateA.selected === rateB.selected ) {
return 0; // Keep relative order if both have the same value for 'selected'
Expand Down

0 comments on commit a13aa52

Please sign in to comment.