Searching Orders by metafield values using GraphQL

I am trying to establish if it is possible to query for Orders resources that match metafield values.

I know that I can query single order using orderByIdentifier query (Working with custom IDs) and I tried that and it succeeds. However, I need a solution to query for multiple values of a single metafield to obtain list of multiple Order resources.

There is a section in the docs which describes that one can query for Products resources using products(first: 20, query: "metafields.custom.material:\"cotton\"") query (Query by metafield value).

However, it apparently works only with Products - I tried it with Orders and it fails.

The same approach is listed here: Use metafield capabilities with a Products example as well.

I tried to apply adminFilterable capability on my Orders Metafields definitions (single_line_text_field), but the mutation returns "The definition is not eligible to be used as an admin filter." error.

I did my tests using 2025-04 release-candidate API version.

As currently implemented, is it possible to perform such Orders search? What I am trying to ultimately achieve is a query to search for Orders by Metafield values using a query built on alternative of predicated, e.g. my_metafield=VAL1 OR my_metafield=VAL2 OR ... .

1 Like

This is impossible at the moment.

Hi Leon,

From digging into this - it does seem that this isn’t currently possible. I’ve connected with the custom data team to see if there is a plan for this ability to be available in the future. The only workaround I can think of is to query all orders along with their metafields and then independently of the API, filter the results to match the metafield - however this may be unfeasible if there’s a large amount of orders.

Thanks. I will need to resort to free-format tags as a workaround.