Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hello all,
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 shown 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.
I have used the below code but it didn't work appropriately on mobile view. The code I have used:
<script>
document.addEventListener('DOMContentLoaded', function () {
const continueShoppingBtn = document.querySelector('.cart-notification__links .button-label');
if (continueShoppingBtn) {
continueShoppingBtn.addEventListener('click', function () {
history.back();
});
}
});
</script>
But as I said it didn't work appropriately on mobile view. Please walk me through step by step on how solve it with pictures.
My URL: https://u7yeji-na.myshopify.com
Well i guess the previous page option is solved as your code is mostly correct.
One thing I see is that on your pdp page it mentions that users need a to add min 3 quantities but I am still able to add to Cart and proceed to checkout lower than that.
Hi @Shadab_dev,
Yes, you are right. Customers can add to cart and proceed to checkout with 1 quantity while they should add to cart no less than 3 quantities. So, can you please help me with this issue without using third party apps? Hope you can help me.
Regards,
Mamdouh
Yeah, this is probably achieveabke with custom coding. Will need Collab access for a convenient process.
Share the Collab access or you can invite me to your store.
Best