Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Metaobject Retrieval

Metaobject Retrieval

tinyman1199
Shopify Partner
9 1 3

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 519

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