Best way to filter all storefront collections for a collection metafield value

Topic summary

Efficiently locating a Shopify collection by a number stored in a “ktype” metafield.

  • Context: ~3000 collections where “ktype” is a single-line text metafield containing a comma-separated list of numbers.
  • Current approach: Use the Shopify Storefront API to fetch collections and filter client-side.
  • Constraint: Storefront API pagination limits batches to 250 collections, making full retrieval and filtering resource-intensive.

Key question:

  • Is there an API-side way to filter collections by a metafield value (i.e., return the single collection whose “ktype” contains a specific number) without fetching all collections?

Technical notes:

  • “Storefront API” is Shopify’s customer-facing GraphQL API; “metafield” is a custom field attached to resources like collections.

Status:

  • No solution provided yet; the thread is seeking an optimized, server-side filtering method to avoid bulk retrieval.
Summarized with AI on December 15. AI used: gpt-5.

I have around 3000 collections with a metafield value “ktype”. Ktype is a single line text field that contains a comma separated list of numbers.

What’s the best way to find the one collection that contains a single number within that metafield?

I was using the storefront API to get the collections and then find the correct one but that’s quite intensive and requires it to be done in batches no bigger than 250 collections at a time. Is there a way to do this without having to get all collections? Is there a way of using the API so that Shopify does the filtering and then just returns the one collection I need?