A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hey there,
I' m trying to use the graphQL query "metaobjectByHandle". I read the documentation pages
https://shopify.dev/docs/apps/custom-data/metaobjects/manage-metaobjects and
https://shopify.dev/docs/api/admin-graphql/2024-01/queries/metaobjectByHandle but none of it solved the problem. The endpoint that I am using is https://<shop-domain>.myshopify.com/api/2024-01/graphql.json and I already set the X-Shopify-Storefront-Access-Token correctly.
The following query is what I'm trying to get to work:
query {
metaobjectByHandle(handle: {
type: "<type>",
handle: "<handle>"
}) {
displayName
}
}
The error that I get is the following:
{
"errors": [
{
"message": "Field 'metaobjectByHandle' doesn't exist on type 'QueryRoot'",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"query",
"metaobjectByHandle"
],
"extensions": {
"code": "undefinedField",
"typeName": "QueryRoot",
"fieldName": "metaobjectByHandle"
}
}
]
}
Solved! Go to the solution
This is an accepted solution.
I solved the problem. I used https://<shop-domain>.myshopify.com/api/2024-01/graphql.json instead of https://<shop-domain>.myshopify.com/admin/api/2024-01/graphql.json
This is an accepted solution.
I solved the problem. I used https://<shop-domain>.myshopify.com/api/2024-01/graphql.json instead of https://<shop-domain>.myshopify.com/admin/api/2024-01/graphql.json