Adding a link that goes to the last collection viewed

Hello!

I found this information online: “Add a ‘Continue shopping’ link to your cart”, specifically the last component of the tutorial for “a link that goes to the last collection viewed”.

I would like to implement this, however NOT as part of a “continue shopping” button; nothing to do with my cart. I simply want to make a button or link in my Product Template that says “go back to collection” etc.

For your convenience, the code in the linked example is as follows:

Continue shopping

JS to go into the Theme.Liquid body:


Will the above script need to be amended and if so, could someone please provide me with adjusted code to suit my needs?

Thanking you in advance.

1 Like

Hi,
You can refer this article https://community.shopify.com/c/Shopify-Design/How-to-add-quot-Back-to-Collection-quot-button-to-the-top-of-the/m-p/580004

1 Like

Thanks for your great example. I rebuild it for my breadcrumb menu and add the last title of the category!