How can I use tag filtering to populate a collection object in Liquid?

How can I use tag filtering to populate a collection object in Liquid?

User_999
Shopify Partner
18 0 4

using Tag Filtering, how would I populate a collection object in liquid? For example, say we have a related tag we're using lets say related-baseball-hats using https://www.mydomain.com/collections/all/related-baseball-hats I can see them all in search. But if I have a product and I pull the tag out, how can I bring back these related products into a collection to show on the product page. Is it possible to use liquid to return a collection based on tag filtering? What is the correct markup.

Thanks!

 

I was hoping something like this would work?

 

 

{% assign my_tagged_products = collection.products | where: "tags", "related-baseball-hats" %}





https://shopify.dev/docs/themes/navigation-search/filtering/tag-filtering

 

Replies 0 (0)