I want to create a global metaobject, store some information in this object, and display the information on website.
But I don’t know how to access this object
{{ shop.metaobjects[‘xxxx’] }} does not work …
I want to create a global metaobject, store some information in this object, and display the information on website.
But I don’t know how to access this object
{{ shop.metaobjects[‘xxxx’] }} does not work …
After creation, You can assign it to a metafield like other option
Create a metafield and choose metaobject there
and you can add data to it under content
Thanks!
Thank you! But it seems I can only and metafield to a product, collection, page, etc. I want to add global object which does not belong to a product or collection. It seems there is a proper global object which I can add my metafield.
Thanks you very much!! The problem is I don’t know how to define a global metafield. It seems all metafields should be attached to a product, variants, collection, etc. Is it possible to define a metafield independently ? Because what I need is a global config which is not belong to a product or variant.
Now I can only define a metafield here:
hey wzc! were you ever able to figure this one out? global metaobjects would be huge!
To define global metafields, Shopify does not have default option for this. We can use free app for metafields like Metafields Guru and after you can use shop metafields to define global object.
Thanks!
Hi @collin-f4d
To define global metafields, Shopify does not have default option for this. We can use free app for metafields like Metafields Guru and after you can use shop metafields to define global object.
Thanks!
Finally figured it out! You can create a global metaobject by going into Settings > Custom data then add a Metaobject definition at the bottom. I created one named ‘Global Meta Data’ where I’ll store all my global variables as fields. To define them go to Content > Metaobjects where you’ll ‘Add entry’ and define your fields. After you define them you can access them in liquid like this:
shop.metaobjects.[type].values
This will list all your defined fields. Type is defined where you created the Metaobject in Custom data.