Setting the owner of a metaobject

Solved

Setting the owner of a metaobject

ejb1
Shopify Partner
7 1 0

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?

Accepted Solution (1)
SBD_
Shopify Staff
1829 271 415

This is an accepted solution.

From the Metaobjects team:
---

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 

View solution in original post

Replies 2 (2)

SBD_
Shopify Staff
1829 271 415

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 

SBD_
Shopify Staff
1829 271 415

This is an accepted solution.

From the Metaobjects team:
---

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