Can I filter collections with Metafields?

Highlighted
Shopify Partner
15 0 0

I'm working on a website for a client and they're looking to filter their different collections of products. We're currently using metafield manager to create these metafields. I've researched through the forums and found this great example by @Mircea_Piturca: https://filter-3.myshopify.com/collections/guitar which is exactly what I'm trying to do. 

 

I'm however a novice at using APIs and don't understand how to proceed after creating a separate template with no layout. Questions I have are:

  • Where does the XHR request go? on another template page? 
  • How does the filtering in Javascript translate back into liquid without building the whole filtered objects in javascript? 

 

Any deeper explanation or pointing in the right direction would be very very helpful. 

 

 

 

0 Likes
Highlighted
Shopify Partner
1365 24 239

Hi @kcaden20 

That is old code, I would do things different now but few things still apply.

 

The XHR is done to this URL: https://filter-3.myshopify.com/collections/guitar?view=filter-json

It is the alternate template URL - collection.filter-json.liquid

 

I am afraid I do not fully understand the 2nd question, can you please give me more data on that one?

Will do my best to help out

 

Thanks

https://sections.design tips, tricks & Shopify sections
0 Likes
Highlighted
Shopify Partner
15 0 0

Actually, never mind. I talked with my client today and realized, we have a collection that has 2000-2500 products within it and building custom filtering is beyond my skill level. We're just going to stick with filtering via tags. 

 

Thank you though! 

 

0 Likes
Highlighted
New Member
6 0 0

 

Rally great explanation. 

I am facing same issue.

Actually i would like to extract collection using meta-field value.

Please review the link : https://community.shopify.com/c/Shopify-POS/filter-collection-by-meta-fields-key-value-pair-using-gr...

Please suggest something. 

0 Likes
Highlighted
New Member
6 0 0

 

Rally great explanation. 

I am facing same issue.

Actually i would like to extract collection using meta-field value.

Please review the link : https://community.shopify.com/c/Shopify-POS/filter-collection-by-meta-fields-key-value-pair-using-gr...

Please suggest something. 

0 Likes
Highlighted
Shopify Partner
1958 123 433

Hi @kcaden20 

I hope you are doing well. 

I think with so many products maintaining filters via tag would be tedious as well. You can use Sparq product filters and search which allows you to create filters manually and dynamically via tags and meta fields.  

You can check the implementations here

Let me know if you need anything else. 

Sparq is a fast and beautiful product filter and search solution for Shopify store owners. It allows store owners to add a custom tag, metadata, or variant based filters on their collection page and upgrade their default search to an extremely fast, more user-friendly and feature-rich search.
0 Likes