Metaobject Retrieval

Metaobject Retrieval

tinyman1199
Shopify Partner
9 1 2

Hi,

I'm making a metaobject via the GraphQL mutation (CreateMetaobject($metaobjectMetaobjectCreateInput!))
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

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 509

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.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog