Jump to customization step when reordering a dynamic product - xmpie-users/uStore-js GitHub Wiki

When a user reorders a dynamic product that they have ordered previously, the product is added to the shopping cart and there is an "edit" link which allows the customer to make changes to the reordered product before checkout.

Alt

When the user clicks the edit link, by default, the user is taken to the finalize step where they can change the order quantity and product properties.

For dynamic products, some customers may prefer to be taken back further - to the customization or recipient list step - which is before the finalize step.

This JavaScript will automatically click the back link if you enter the finalization step from the cart page:

<script type="text/javascript">
$("document").ready(function() {
  // If the referring page is the cart page, and there is a previous button on the page, redirect to that location
  if (document.referrer.indexOf("Cart") > -1 && $("#ctl00_cphMainContentFooter_WizardStepsNextPrev1_ButtonPrev").length > 0)
  { 
    document.location.href = $("#ctl00_cphMainContentFooter_WizardStepsNextPrev1_ButtonPrev").attr("href"); 
  }
});
</script>

For information on how to add JavaScript to your store: How to add JavaScript to a storefront.

⚠️ **GitHub.com Fallback** ⚠️