Syntax for "query" argument in GraphQL (Storefront API)

Shopify Partner
18 0 8

Hello guys, I'm wondering what's the syntax we should use for the "query" argument many of the Objects offer. The documentarion say "String" and passing for example "Accessories" to find Products in the "Accessories" collection works. But it feels a little loose. Is there a way to make it more explicit that I'm only searching for collections called "Accessories"?

This was just an example, any information on the topic will contribute a lot! Thanks!

Replies 18 (18)
Shopify Partner
11 0 1

I'm looking for the same information myself.  

You can do exact matching - e.g.

query:"title='My Title'"

I've not figured out how to do partial matches, so for me it is less useful than not providing the field but it might be what you are after.




Shopify Partner
18 0 8

Thanks for replying! That's a confusing feature because it only seems to work in some cases. For example, if I do:

products(first: 10, query: "title='Verma'")

It works, but if I do:

products(first: 10, query: "product_type='Men'")

It does not work even though the documentation says "product_type" is supported as a filter in the query argument.

Do you see anything I might be doing wrong here?


New Member
1 0 2

I've not managed to get any of the other filters working either..  


It would be really helpful for some at Shopify to help explain how to use it. 

Shopify Partner
18 0 8

Just got a reply from a staff at Shopify and from his response and my tests I understood that you can do things like:

products(first:10, query:"product_type:'Men'")


products(first:10, query:"product_type:'Men' title:'My product'")

There has to be no space between the colon and the value queried, and there is no comma between parameters. Also, it's case insensitive. 

Shopify Partner
11 0 1

Great!  That helps.    Was there any info on how to do partial matches?

Shopify Partner
18 0 8

Unfortunately our guy didn't say much cause he himself didn't have a lot of experience with this API. I'm hoping we'll see more developments on it soon as it's a killer feature on Shopify's tool belt :)

8 0 1


I need to filter product list but getting this error after passing parameter in product

 products(first:10, query:"product_type:'Men' title:'My product'")

Error Message

 "message": "Field 'products' doesn't accept argument 'query'"


Please suggest

Shopify Partner
14 0 10

So, this is a bit of a mess. And believe it or not, this thread is currently the best documentation on how to use the query field.

@Shopify, please help us out here as we're currently doing guesswork.


Here's what I know so far:

While you can see what query fields are claimed to be supported here ( it is actually not accurate. Only some of those fields are in practice supported. But, some actually do work.

I'm currently working on orders() and for this it seems that the status of the working/non-working query fields are:

- email: not working

- status: not working?

- fulfillment_status: IS WORKING

- customer_id: IS WORKING

When running queries, the correct format is this:

orders(first:3, query:"customer_id:871660388411")

The incorrect format is this (incorrectly claimed to be correct in a previous post):

orders(first:3, query:"customer_id=871660388411")

(e.g. do not use '=' but instead ':'

It seems that the query field is insensitive to extra quotations for at least numbers. The following does work:

orders(first:3, query:"customer_id:'871660388411'")

It is also insensitive to left out quotations for strings.


I hope this helps someone out there trying to get this working despite of Shopify's complete lack of documentation and support for the community.


Shopify Staff
492 42 114

Have you seen this doc:

Ryan | 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 the Shopify Help Center or the Shopify Blog