Hi All, I have the following graphql query.
query ($first:Int!, $collectionId:ID!, $query:String){
products(first:$first,query:$query) {
nodes {
inCollection(id: $collectionId)
}
}
}
{
"first": 1,
"query": "id:8880883990804",
"collectionId": "gid://shopify/Collection/468654686484"
}
Which when running in graphiql works just fine and returns the desired results.
"data": {
"products": {
"nodes": [
{
"inCollection": false
}
]
}
},
so I want to incorporate this query in my extension.
const { data } = await query(
`query ($first: Int!, $collectionId:ID!, $query:String) {
products(first: $first, query: $query) {
nodes {
inCollection(id: $collectionId)
}
}
}`,
{
variables: {
first: lines.length,
query: idQuery,
collectionId: collectionId
}
}
)
but data is coming back undefined.
I tried several variations even hardcoding all the values, the only thing that seemed to work is when I left the “inCollection” out, but thats kind of the whole point of the query is to find out if the line items is part of a specific collection.
Could it be that inCollection is not currently supported via the storefront api?
UPDATE:
I fixed the access scope issue and now have the appropriate access scopes granted to the extension but still the issue remains that as soon as I include the inCollection property in the GraphQL query the query fails to return anything.
Anyone have any ideas?
Cheers,
Gary