A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
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?
Solved! Go to the solution
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 | Solutions Engineer @ 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 Shopify.dev or the Shopify Web Design and Development Blog
I have the same problem but it is with draftOrders @@
This is really frustrated though
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 | Solutions Engineer @ 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 Shopify.dev or the Shopify Web Design and Development Blog
@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
Hey @Tolulope_Akinol
Thanks for the heads up on that! I will look into getting that corrected.
Kevin_A | Solutions Engineer @ 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 Shopify.dev or the Shopify Web Design and Development Blog
Hey @ Kevin_A
How can I filter product not have specific product_type (like the way NOT tag or -tag, NOT vendor or -vendor)