I’m new in Shopify. My website is in Dawn Theme.
When our customers click on ADD TO CART and then on CONTINUE SHOPPING, they are sent back to the very top of the scrollable catalog (around 250 SKUs) instead if the area where the last selected item was.
That can be very annoying for customers who are compelled to scroll back down over over and over again.
How do I fix that?
You have to store the scroll position in the cookie and use this code so when a user comes back to the page they go to their last scroll position.
Note: There are more things to do in order to make it work only after they comes back from cart page.
$(window).scroll(function () {
//set scroll position in session storage
sessionStorage.scrollPos = $(window).scrollTop();
});
var init = function () {
//return scroll position in session storage
$(window).scrollTop(sessionStorage.scrollPos || 0)
};
window.onload = init;
Thank you! I’ll try that!