Metaobject Filtering - Categorisation - Is it possible?

Shopify Partner
6 0 3

I'm enjoying using the Metaobjects. And have successfully deployed them for some custom content across client's sites.


Recently we considered using metaobjects to store our "stockist" locations - previously this used an adapted version of the blog to do this.


Metaobjects appears to offer a nicer UI/UX for content editors.


But I have run into a problem, I appear to be able to filter using "where" etc for certain fields. But I cannot do this in combination with pagination. 



To explain in simpler terms, I have a metaobject called "Stockists"


Example of an item:


Stockist name: Acme LTD

Stockist location: France, Germany, UK, USA etc.


I want to paginate these on one page in alphabetical order. But I also want to be able to allow website visitors to filter them, for example click on "Germany" and only get the germany results returned with pagination.


I can do this sure with javascript - but I can only get a maximum of 50 items output on the page because of Shopify limits. I could also make separate pages for each "country" and link to those, but this is quite clunky/messy as well.

At this point it feels like maybe just hacking the "blog" would work better.


Does anyone know if there is a simpler way? Of either filtering metaobject items within pagination? OR returning more than 50 metaobject items to the page?


Thank you!

Replies 2 (2)

Shopify Staff
2731 302 779

Hi Sdevscotland,


It's hard to say for sure if this is possible or not without seeing the full code, but I was able to paginate metaobject pages with the method described in this blog post, so it could work. Is pagination appearing if you don't use `where`?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit or the Shopify Web Design and Development Blog

Shopify Partner
6 0 3

Hi Liam thanks for the reply. I don't think I explained well, I want to filter - e.g. a metaobject called "Ice Cream Shops" has a list of ice cream stores, each store has a flavours field called "flavours" - with one or more of the following values: "vanilla", "strawberry" or "chocolate". Is there a way to use Shopify filters - the same way we have for collections - with metaobjects?


E.g. here is all the ice cream shops. Click "strawberry" to filter for only the shops with Strawberry ice cream. Click "chocolate" to filter for only the shops with Chocolate ice cream, etc.


At the moment I run into a few problems:


+ Attempting to output all the values just do the filtering client side with JS - I can only return 50 metaobject values per page because of Shopify limits - so my solution only works when there is less than 50 ice cream stores.




+ Using Pagination liquid tags. This gives me 50 per page. But I can't "filter" the results - is there something I can do to edit the pagination to give me filtering abilities? 


Otherwise I think I'll just have to create separate pages for each of my filtering requirements - and link them with a menu.