Make Metaobjects available in paginate

Since the update on the new pagination limits: New pagination limits for Liquid & Storefront GraphQL API - Shopify developer changelog has broken the “hack” to get all the Metaobject Entries: Using Metaobjects. Cannot access more than 50 entries in theme. - Shopify Community one of our most important page has broken.

We and a lot of other merchants rely on the need to get way more then 250 items to display data in custom pages. This is absolutely not working with “next” page user interaction. In our case we show a page with all the brands. Now it just cut’s off and there is no good way to get around this part.

We and a lot more merchants would really need this to be in the list here: Liquid tags

1 Like

Hi @AdminGh — can you share a bit more about your use case? Querying every metaobject in a shop is an expensive, unbounded operation and there are usually better ways to fetch the relevant data, such as a metaobject reference list metafield on the corresponding resource.

Hi @rpenner,

In our case we have a page to find all the Brands we sell where a user can scroll trough:

Now it just stops and there is no way around this in liquid. If a merchant uses this as a stand alone entity (and a lot do because of the beauty of the Metaobject ifself) then the get this from the corresponding resource is totally not in the use case of a lot of merchants. This is a significant drawback and really limit the use cases of this fantastic concept.

You could access the metaobjects via the Storefront API which allows pagination, and also specify the metaobject type to retrieve just what you need.

@Luke I understand but would like to stay in Liquid.

I understand that, but there is no promise this feature will be added, nor quickly if it is.

So you’ll need to adapt to available workarounds for now.

You can try something like this, it works on my end up to 1000 entries:

{% liquid
  assign entry_count = metaobjects.type.values_count
  assign entry_list = metaobjects.type.values

  paginate entry_list by entry_count
    for entry in entry_list
      # Here, you have access to the individual metaobject entries
      # Always paginated to the correct number, up to 1000 entries
    endfor
  endpaginate
%}

@teamdijon thank you for this tip!

1 Like

@teamdijon
values_count brings the count, but it doesn’t exists in any documentaion.

Where did you get that from?

Not everything is always documented, its pot luck sometimes.

Hello @Alon_Joshua,

You can find the reference here: Liquid objects: metaobject_definition

1 Like