We want to be able to access and display Search & Discovery filters on product pages.
For instance, let’s say I have a cotton tee shirt that is part of the Material → Cotton filter label. We want to be able to put a link on the page that links to all other products with the same material value (Cotton).
Can Search & Discover filter data be accessed on product pages to enable linking in this way?
Hi,
Access product’s filter value using metafields or tags
Display Filter Data on the Product Page by using liquid code
Code example for metafields
{% if product.metafields.custom.material %}
Material: {{ product.metafields.custom.material.value }}
{% endif %}
Code tag example
{% assign material = product.tags | where: 'Material' %}
Material: {{ material }}
Create a link that applies the same filter to a collection or search page, enabling customers to view related products.
Thank you.
In Search & Discovery you’re able to group metafields into categories. I.e. if you had mixed capitalization in your metafields for some reason you could put “cotton” and “Cotton” into one filter so they don’t show up as two options.
Is it possible to get the value of the category filter so I can build links that would include all products in the category filter?