How to build Metaobjects
Metaobjects allow to create and store a custom data with the following displaying this new structured information in the storefront.
Last updated
Metaobjects allow to create and store a custom data with the following displaying this new structured information in the storefront.
Last updated
The same metaobjects can be used across multiple pages, allowing you to edit the information just once in your admin and automatically update it in all sections where the metaobjects are used throughout a store.
Find more information about Metaobjects in the following documentation.
To organize and display the additional structured information in your store, follow the next main steps:
To create and store additional information in your store, create a Metaobject definition with the list of entries. Each entry will include as many fields as you form while adding the Metaobject definition. The entries can be used to display in different theme sections and blocks.
Add Metaobject definition. Go to Shopify Admin -> Settings -> Custom data -> Metaobject definitions and press the “Add definition” button:
Then, type the name of the metaobject definition and change the “Type” if needed:
In the “Fields” drop-down, choose the type of the field:
Edit the popup to create a new field:
Add as many fields as needed:
Hit the “Save” button to store settings.
Operate Metaobject entries. To edit fields, you are going to create metaobject entries.
Navigate to Content -> Metaobjects in your Shopify admin and press the “Add entry” button. Next, choose the Metaobject definition in the drop-down for which the entry will be used:
Then, edit fields with the content. And save the changes.
In case you need to use custom icons, you can find the list of icons here.
Add as many entries as you need:
Create a Metafield definition to connect Metaobject entries with a product. Thus, you will be able to assign each entry to a Metafield in the desired sequence and for each individual product.
Add a Metafafield definition. Go to Shopify Admin -> Settings -> Custom data -> Metafield definitions and choose the part of a store to create metafields definitions. In our case, it will be “Products”.
Then, press the “Add definition” button:
Create a metafield with the format:
Name = e.g. Feature 1
Namespace and key = custom.feature_1
Description = Your text (optional)
Select content type -> Metaobject
Reference = your Metaobject definition
Save the changes.
Add numerous metafields:
Connect Metafields with the entries for a product. Navigate to Products and select a product.
Use each Metafield to connect with different entries:
Save the settings.
To link metaobjects to the theme blocks or sections, go to the theme Editor and select a part of a store to work on it, for example, “Products”. Then, decide what section or block to use on a page:
Press the source icon next to each field in the block/section to connect the Metaobject reference with the field:
In the Metaobject reference, select an entry to use for each field:
Use different Metaobject references to connect with different sections in the block:
Save the settings.
The same metaobjects can be used in other dynamic sections on the Product page. Add a section and specify the content using the source icon.
In our example, we used the “Information line” section with three “Content” blocks: