Skip to content

Commit

Permalink
Merge branch 'develop' into pdp-containers
Browse files Browse the repository at this point in the history
  • Loading branch information
fnhipster authored Nov 26, 2024
2 parents fa2484d + 24012e9 commit fd73457
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions blocks/commerce-checkout/commerce-checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -812,19 +812,21 @@ export default async function decorate(block) {
};

const handleCheckoutOrder = async (orderData) => {
// clear address form data
// Clear address form data
sessionStorage.removeItem(SHIPPING_ADDRESS_DATA_KEY);
sessionStorage.removeItem(BILLING_ADDRESS_DATA_KEY);

const token = getUserTokenCookie();
const orderRef = token ? orderData.number : orderData.token;
const orderNumber = orderData.number;
const encodedOrderRef = encodeURIComponent(orderRef);
const encodedOrderNumber = encodeURIComponent(orderNumber);

window.history.pushState(
{},
'',
`/order-details?orderRef=${encodedOrderRef}`,
);
const url = token
? `/order-details?orderRef=${encodedOrderRef}`
: `/order-details?orderRef=${encodedOrderRef}&orderNumber=${encodedOrderNumber}`;

window.history.pushState({}, '', url);

// TODO cleanup checkout containers
await displayOrderConfirmation(orderData);
Expand Down

0 comments on commit fd73457

Please sign in to comment.