Ad

In Shopify, How Do I Find And Display The Current Product Tag Of A Page?

- 1 answer

For example, if I am on page URL:

collections/tableware/plates

I want to create a breadcrumb that says:

home >> tableware >> plates

where tableware is a collection name and plates is a product tag. How do I pull up the current product tag (and only that product tag, I don't want to display all here)? Seems like it should be easy, but I still haven't figured it out. Thanks!

Ad

Answer

I think current_tags is what you're looking for:

Inside collection.liquid, current_tags contains all product tags that are used to filter a collection.

For the URL collections/some-collection/tag1, current_tags contains tag1.

Note that current_tags is an array, and may contain multiple tags. For example, there are 3 current tags for this URL: collections/some-collection/tag1+tag2+tag3.

Ad
source: stackoverflow.com
Ad