Hello!
I want to build a “only show products in stock” filter using the GraphQL Admin API.
I can do this when I use the products root query like this, which is exactly what I want/need:
products(query:inventory_total<1) {
title,
description
}
However when I want to do the same with collections, the inventory_total query isn’t a valid option for collectionByHandle. ![]()
DOES NOT WORK:
collectionByHandle(handle: "shoes") {
products(query:inventory_total<1) {
title,
description
}
}
Now I know I could query products using the collection_type field but then I lose sortKey options like price and best_selling which I also need.
Seems like a gap in functionally and was wondering if anyone knows a way to return a collection with just in stock items and not just using the products root query as it has limited sorting options.