Solved

metaobjectByHandle - doesn't exist on type 'QueryRoot'

gaze
Visitor
2 1 0

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"
      }
    }
  ]
}

 

 

Can anyone help me with this issue? Any hint would me much appreciated!
 
Thanks!
Accepted Solution (1)

gaze
Visitor
2 1 0
Reply 1 (1)

gaze
Visitor
2 1 0

This is an accepted solution.