Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hello all,
I'm encountering an issue with a GraphQL query on Shopify. When requesting a specific collection using a metafield (idnodo with value 560), the response I get is for a collection with a metafield idnodo value of 591.
Has anyone experienced something similar or has any insights on why this might be happening? I've attached my GraphQL query and the response for further details.
Query
{
collections(first: 1, query: "metafield:custom.idnodo.value=588") {
edges {
node {
id
title
metafields(first: 1, namespace: "custom") {
edges {
node {
key
value
}
}
}
}
}
}
}
Response
{
"data": {
"collections": {
"edges": [
{
"node": {
"id": "gid://shopify/Collection/403918323931",
"title": "MURAL",
"metafields": {
"edges": [
{
"node": {
"key": "idnodo",
"value": "591"
}
}
]
}
}
}
]
}
},
Thanks in advance for any guidance.
Hi there 👋
At this time metafields are not a supported query filter for collections. The supported query filters are:
collection_type
product_publication_status
publishable_status
published_status
title
updated_at
When an unsupported query filter is used, it is ignored. So in your example your query is just returning the first collection.
I definitely understand how this functionality caused confusion, and I will be relaying that to the team.
To learn more visit the Shopify Help Center or the Community Blog.
Fantastic clarification, in fact the message made me think it was possible.
Many thanks for the clarification,