Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
I'm wanting to create metaobjects owned by pages (like can be done with metafields), but I can't see any information on how to do this.
The metaobjects introduction says this:
Similar to metafields , they can be associated with a Shopify resource such as a product or a collection.
but there is no other reference to this anywhere else in the metaobjects docs. The only way I can see to connect an object to a resource is by setting a metafield with a metaobject reference on the resource, but this seems like a strange way for this to work and, I assume, won't delete the metaobject when the resource is deleted.
Am I missing something or is there really no way to properly associate a metaobject with a resource?
Solved! Go to the solution
This is an accepted solution.
From the Metaobjects team:
---
The only way I can see to connect an object to a resource is by setting a metafield with a metaobject reference on the resource,
Yep that’s exactly how you do it
and, I assume, won't delete the metaobject when the resource is deleted
This is also correct.
The key idea is that each metaobject definition is a new “resource/primitive”, and thus its entries are global, hence you can only create references to it.
Scott | Developer Advocate @ Shopify
Hey @ejb1
> The only way I can see to connect an object to a resource is by setting a metafield with a metaobject reference on the resource.
I think that might be the case - double checking with the Metaobjects team and will report back.
Scott | Developer Advocate @ Shopify
This is an accepted solution.
From the Metaobjects team:
---
The only way I can see to connect an object to a resource is by setting a metafield with a metaobject reference on the resource,
Yep that’s exactly how you do it
and, I assume, won't delete the metaobject when the resource is deleted
This is also correct.
The key idea is that each metaobject definition is a new “resource/primitive”, and thus its entries are global, hence you can only create references to it.
Scott | Developer Advocate @ Shopify