I would like to be able to search for products that have inventory tracking in Shopify enabled, hopefully by adding a query filter is_inventory_tracked
and only returning products that are or aren’t tracked.
I asked the .dev Assistant what you wrote and it responded with:
To search for products that have inventory tracking enabled in Shopify, you can use the
products
query with a filter on thetracksInventory
field.
Using this: query: "tracks_inventory:true"
I have not tested it but the .dev Assistant is a great tool you could use to try to get quick answers to test with!
Unfortunately if you had tested it you would have found that the .dev Assistant is prone to hallucinations and this is one such example
Yeah, I had a feeling. I was out and about earlier and could not test.
Did some more asking and got this:
If you want to filter products based on whether they are tracked or not, you would need to handle this logic on the client side after retrieving the data
so my guess is that it is simply not possible to do yet.
Hopefully the team will chime in and pass the feature request along to get it added for us all.
Hi folks, this is a feature we understand has benefits, but it’s currently not on our roadmap to support
Hi there,
the problem with this answer is that, in a direct migration from REST to GraphQL, it may be not possible due to a lack of permissions. In order to know if a variant is or not tracked, you need to request the variant::inverntoryItem::tracked info:
However, to gather that info with GraphQL, ‘read_inventory’ permission is unfortunately required, while gathering the same info with REST API does not need that permission.
I think that this is a real problem thinking about the migration, as it may make it really difficult, or even impossible if you need to ask a permission upgrade to thousands of merchants. Anyway, take a look to the variant::availableForSale field. Depending on the nature of your problem, it may help.
We are working on a path forward to this issue with the migration