Listing filters on a page as links (e.g. show visitor "Brand" values for all products)

Listing filters on a page as links (e.g. show visitor "Brand" values for all products)

stormeagle
Excursionist
19 0 4

Let's say I have a custom metafield named "Brand" with single text field type and I have the Shopify Search & Discover app configured to let users filter by this Brand field. I want to make a "Brands" page that lists all the brands entered on products. The brands would link to filter result URLs.

 

I haven't been able to figure out how to use Liquid to loop through filter options. Here's my filter sidebar. I want to mimic that list of brands but on a page as links.

 

Screenshot 2024-10-10 at 1.46.45 PM.png

Replies 2 (2)

PaulNewton
Shopify Partner
7450 656 1562

Hi @stormeagle  👋 Roughly do a filter loop and just check if it's a specific name e.g. "filter.label" or some other property of the filter object.

 

Start at first principles

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

Create a minimal reproducible example https://stackoverflow.com/help/minimal-reproducible-example 

of only the relevant logic as otherwise filtering code can be very long an verbose making it larger chore for others to try and help.

 

If you don't want to be a web developer and just need this customization then contact me for services
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.

 

Good Hunting.

 

 

Contact [email protected] for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


stormeagle
Excursionist
19 0 4

Thank you for the guidance.

I see now that the filters object is available only on collections and search. I want to make an index of filter values on a page using a Liquid widget in a page template. I'm able to loop all products to get values (and count) for a metafield like Brand but that's really not performant and has a 1,000 product limit anyhow. Guess I'd need to develop an app to accomplish this outside of Shopify's environment.

 

https://shopify.dev/docs/api/liquid/objects/filter

 

Screenshot 2024-10-11 at 10.48.32 AM.png