I am running a query, looking for all variants that have 0 or less in stock and have CONTINUE as its inventory policy.
The query is tested and works in all ways but the ignored query.
It does filter by inventory_quantity correctly, but ignores the second query, returning variants both with inventory_policy CONTINUE, and DENY.
I've tried using CONTINUE, continue, or Continue. I've tried setting the parameter as inventoryPolicy instead of inventory_policy. I've tried removing the quantity parameter, only querying "inventory_policy:CONTINUE". The query does return the inventoryPolicy, and its content is either "DENY" or "CONTINUE"
query: "inventory_policy:CONTINUE AND inventory_quantity:<=0"
We are making hand crafted Red Hats together with my mom in Norway.
Your GraphQL query seems correct in its structure. The productVariants query with the query parameter is the right way to filter product variants based on certain conditions. However, there are a few things to consider:
Exact Match: The query parameter in Shopify's GraphQL API uses a search syntax similar to the one used in the Shopify admin. It's possible that the inventory_policy field doesn't support exact matching in the way you're attempting.
Alternative Approach: If the direct query doesn't work as expected, you might need to fetch the variants based on one condition (e.g., inventory_quantity:<=0) and then filter the results on your server or client side to get only those with inventoryPolicy set to CONTINUE.
Testing: Use tools like Shopify's GraphiQL app to test your queries. This tool provides real-time feedback and auto-suggestions, which can help identify issues.