Admin GraphQL query filter not working

Solved
Highlighted
Shopify Partner
24 1 0

One of the samples in the product query section of the Admin GraphQL illustrates how you can use the "query" variable to filter product nodes by productType (https://shopify.dev/docs/admin-api/graphql/reference/object/product)

 However, the filter query:"productType:shirt" returns nodes with productType different than "shirt".  I also tried this query in a live shop and had similar results.  Is it possible to filter results with a query on  productType or other fields?

 

Screen Shot 2020-09-24 at 12.22.13 AM.png

0 Likes
Highlighted
New Member
3 0 0

I have the same problem but it is with draftOrders @@

https://community.shopify.com/c/Shopify-APIs-SDKs/draftOrders-first-10-query-quot-email-bob-slydell-...

This is really frustrated though

0 Likes
Highlighted
Shopify Staff
Shopify Staff
148 19 26

This is an accepted solution.

Hey @Tolulope_Akinol 

You are querying on a field that doesn't exist, hence why the results aren't as expected. If you look at the documentation for the product query root, it specifies you can query on "product_type" not "productType". See here for reference: https://shopify.dev/docs/admin-api/graphql/reference/queryroot

Kevin_A | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Shopify Partner
24 1 0

@Kevin_A Thanks for the clarification but the screenshot is directly from the Shopify documentation so I would recommend updating it to remove the wrong field reference

0 Likes
Highlighted
Shopify Staff
Shopify Staff
148 19 26

Hey @Tolulope_Akinol 

Thanks for the heads up on that! I will look into getting that corrected. 

Kevin_A | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes