In my testing I was entering this into the “query variables” section, but it doesn’t seem to matter too much, it was consistently failing for me:
The first thing I would say is you can’t use the “collection” query to search for a collection by handle.
Thank you for trying to help, but this isn’t actually true. You might be familiar with an older version of the API. If you click on this link to the storefront GraphQL explorer, you will see that using the collection query I posted above, does in fact let you query for a collection by it’s handle. In fact, if I try to use collectionByHandle, you’ll a see message in the explorer that that API has been deprecated.
Here is a stripped back query showing you that the query works:
query COLLECTION_QUERY {
collection(handle: "latest-stuff") {
id
products(first: 20) {
edges {
node {
id
# everything _except_ variants seems to work here
}
}
}
title
}
}
Then in the products query, you’re using a lot of variables that you’re not passing in:
That is true, but I need those variables in the real query. This was just a simplified version.
I wasn’t setting the first param on variants ?‍
Thanks so much, that was it! For some reason now I’m actually getting a useful error when I leave first out (previously it said something along the lines of there was a problem on the backend).