Redirecting the “Continue Shopping” link to the last collection viewed

Shovgi
New Member
1 0 0

Hi there folks,

I am using the Debut Theme and would like the “continue shopping” link in the cart, as well as the “continue shopping” link in the dropdown drawer to redirect the user to the collection which  they just added a product from.

I’ve seen some similar posts on the subject but the only thing I’ve been able to effect is either having the link go to the home page or one specific collection (vs. the collection the user was actually looking at)

 

Thank you in advance for any help and advice!

0 Likes

One solution is to add the following to a link:

<a href="javascript&colon;history.back()">Go Back</a>

Or to a button:

<button type="button" onclick="javascript&colon;history.back()">continue shopping</button> 

This basically works as clicking the "Back" button in your browser, and will lead people to the previous page.

There's a bit sophisticated way to do it with a bit more JS, as here the right mouse click won't work correctly.

0 Likes