Metaobject Retrieval

Topic summary

Main issue: After creating a Shopify Metaobject via the CreateMetaobject GraphQL mutation, the poster needs its ID to reference it in a customer metafield. The creation response didn’t return an ID, and they were unsure how to retrieve it using metaobjectByHandle.

Key clarification: Support explained that a Metaobject’s handle acts as a custom identifier. You can query the Metaobject by its handle using the metaobjectByHandle query (see the linked docs example) and then read the returned ID to use in the customer metafield.

Notes:

  • Metaobject: a custom data object in Shopify.
  • Metafield: a custom field attached to a resource (here, a customer) that can reference other objects.

Outcome/status: Guidance provided with documentation reference; no explicit confirmation from the original poster. The thread appears addressed but not explicitly resolved.

Summarized with AI on January 30. AI used: gpt-5.

Hi,

I’m making a metaobject via the GraphQL mutation (CreateMetaobject($metaobject: MetaobjectCreateInput!))
I then want to reference this MetaObject in a customer metafield, as far as I can tell, to do this I need the metaobject ID. The ID is not passed back when making the metaobject so I need to request it using the objects handle, however I dont understand the documentation about that request (https://shopify.dev/docs/api/admin-graphql/2023-01/queries/metaobjectByHandle)).
Any help would be appreciated.
Thanks, Tom

Hi @tinyman1199 , the handle in a Metaobject can function as a custom id. You can retrieve a Metaobject by querying the handle as an ID. There is an example in this doc here that might give more clarity on that query. Hope this helps.