In REST API it was possible to filter products list by collection like this:
ShopifyAPI::Product.all(collection_id: "...")
We have similar filter on productVariants
query in Graphql:
But for some reason this filter is not available for products
and productsCount
queries:
It is possible to get products using collection
query, but it doesn’t supports product filtering by status, so it’s not a viable replacement for an old REST approach.
This is critical issue for us, as it doesn’t allows us to fully migrate to the new products API and the deadline is approaching quickly.
4 Likes
Connecting with the product team on this one Kirill - will update when I know more.
1 Like
What’s stopping you from querying the products of a collection and including the filter query within that? Is that what you are saying does not work?
I believe it would look something like the following, if it works (as I have not had a chance to test this sort of solution).
collection(id: "X") {
products(query: "Y") {
...
}
}
There’s no query
argument on products
connection inside collection
resource. And I had issue with collection resource returning empty product list randomly so can’t really trust it.
1 Like
Hi Kirill,
After connecting with the Products API team on this, we’ve recorded this limitation and will work on a fix. I don’t have an ETA to share right now, but will update here once available.
4 Likes