A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
query product from collection
query myquery{
collectionByHandle(handle:"handle_name")
{
products(first: 10 query:"price:>10 price:<=8000")
{
edges
{
node
{
id
title
variants(first:10)
{
edges
{
node
{
id
price
}
}
}
}
}
}
}
}
but I'm not able not to get products, i got response as 'access denied'
{
"data": {
"collectionByHandle": null
},
"errors": [
{
"message": "access denied",
"locations": [
{
"line": 7,
"column": 7
}
],
"path": [
"collectionByHandle",
"products"
]
}
],
"extensions": {
"cost": {
"requestedQueryCost": 133,
"actualQueryCost": 3,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 997,
"restoreRate": 50
}
}
}
}
Hi @Deva ,
This is known behaviour. Shopify does not support the filtration/query of products within a Collection connection in the GraphQL Admin API, due to the expensive nature of queries. However if you removed the 'query' argument from the products and kept it as "first:10" only, you would not get any errors. Read the threads here for more information:
https://community.shopify.com/c/Shopify-APIs-SDKs/Graph-QL-Access-denied-Issue/td-p/572801
To learn more visit the Shopify Help Center or the Community Blog.
Thank you @hassain for your reply ,
I'll need to filter products by particular range within a collection, is there any room to retrieve it ?
{
collectionByHandle(handle: "hip-hop-legends") {
products(first: 100) {
edges {
node {
id
title
}
}
}
}
}