Breadcrumbs for products in multiple collections

Hey,

For products in multiple collections, is there a way to code the last visited collection into the breadcrumb instead of showing a random collection in the breadcrumb?

  1. Write script code at collection listing for product block.

  2. When the user clicks on the product on the listing page.

  3. Store the current collection name and its URL somewhere. replace that variable every time the user clicks on the product.

  4. By this way you will have the last visited collection name and URL in the variable.

  5. At the product page you just need to update the current breadcrumb value with stored info.

Is there a solution to these instructions?

If your theme uses collection-aware product URLs like /collections/XXX/products/YYY, then on product page you would have a collection object defined and can use this for breadcrumbs.

People tend to not use these for SEO reasons and recent versions of Dawn, if I am not mistaken, use only /products/YYY urls for collection pages.

In this case, yes, you should do it with JS, store collection title and url in SessionStorage and pull it from there on the product page.

Something similar to:


Need to update condition to match the actual theme and add code to update actual breadcrumb.