When a customer adds a product to the cart, a cart notification pop up window appears. On the cart notification pop up window, there is a “continue shopping” link showen and when it clicked, it just goes back to the product they have selected. Instead, I want the “continue shopping” to go back exactly to the previous page not to the home page or other pages.
Please walk me through step by step on how solve it with pictures.
After editting and saving the theme.liquid file, the added product did not appear in the cart on the mobile version. Can you help me solving this issue? Thank you.
I’ve been trying to adjust the “Continue Shopping” link that appears in the cart notification popup. Right now, it just sends users back to the product page, but I’d like it to take them back to the actual page they were on before adding the item—like a collection, blog, or landing page.
I tried adding a bit of JavaScript using window.history.back() so it pulls the browser’s previous page. It does send them back in most cases, but it’s not always reliable, especially if they refreshed the page or came from an external site.
This will return you to a literally previous page.
You can replace document.referrer with Shopify.routes.root to redirect people to homepage or Shopify.routes.root + “collections/all” to send them to your “all products” collection…