> For the complete documentation index, see [llms.txt](https://mpithemes.gitbook.io/unicorn-shopify-theme/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mpithemes.gitbook.io/unicorn-shopify-theme/faq/understanding-of-metaobjects-and-their-use-in-a-store.md).

# Understanding of metaobjects and their use in a store

Metaobjects is a Shopify tool that helps add and store new data in the admin, which can then be displayed on store pages via theme functionality, sections, or blocks.

This article provides several examples of how metaobjects can be used in practice within the theme.

Additionally, follow Shopify's recommendations to use metaobjects in other parts of the theme. More about metaobjects can be read on the following [<mark style="color:blue;">help page</mark>](https://help.shopify.com/en/manual/custom-data/metaobjects).

### Display unique content per product

{% hint style="info" %}
To separate a product or group of products for which the unique content will be used, create a new [<mark style="color:blue;">template</mark>](/unicorn-shopify-theme/faq/how-to-create-a-template.md)<mark style="color:blue;">,</mark> as a new block will be added to a page that may be unnecessary for other product pages.
{% endhint %}

First, let's explore how to add new data for products that dynamically change based on a product. To complete this task in your store, follow these steps:

#### **Step 1**

{% hint style="info" %}
**Creating the metaobject!** This step is required to create a new metaobject definition with entries that allow you to add and store new data in your admin.
{% endhint %}

Go to your *Shopify admin -> Settings -> Metafields and metaobjects -> Metaobject definitions* and click on the **"Add definition"** button.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FYn9LPZaIaqTrcTfUe9ZW%2Fmetaobjects_add.png?alt=media&amp;token=e2050d81-ef6b-4f5a-bce3-f8b4cc9ccdf3" alt=""><figcaption></figcaption></figure>

Create a metaobject definition by adding its name and fields.\
In our example, we created a definition named **"Additional details"** and **three fields**.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FF50Gg3leCXxNtt3VLCYD%2Fmetaobjects_additional%20details.png?alt=media&amp;token=e3e5a2d9-9209-4d67-b9ff-17115485348a" alt="" width="374"><figcaption></figcaption></figure>

<mark style="color:orange;">**Note!**</mark> A field of type **"File"** cannot be used as the display name of the metaobject entry that is generated in the next step. For personal convenience, create an additional field specifically for this purpose if you need to display only an image on the storefront (without using text fields), for example:

**First field.** The first field is set to display an entry title. So, it is created using the following parameters:

* Field label - **Title**
* **Single line text** **- One value**

**Second field.** The next field is added to display text paragraphs:

* Field label - **Text**
* **Single line text** **- One value**

**Third field.** Add a field with the following parameters to display an image:

* Field label - **Image**
* **File** - **One file**

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FFPgPZJ8c2WBBQxjPu7oq%2Fmetaobjects_fields.png?alt=media&amp;token=03d0aa0b-3f06-4356-8ea5-aed5616eee12" alt="" width="372"><figcaption></figcaption></figure>

**Step 2**

To add metaobject entries, go to *Shopify admin -> Content -> Metaobjects -> select an entry*. Then, click the definition name.  Then, hit the **"Add entry"** button.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FjN6a3rsc9ic80j5WDNhK%2Fmetaobject_add%20entry.png?alt=media&amp;token=973e6656-59dd-4182-b2d4-7ec2079f8bdb" alt=""><figcaption></figcaption></figure>

Create as many entries as necessary by editing the provided fields, for example:

* Title - name the entry.
* Text - add the desired text line.
* Image - select an image.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FDlhAbVfVolBX9mdDBWUr%2Fmetaobject%20entry.png?alt=media&amp;token=85594546-9677-4dd6-bd86-ae9575f5f67a" alt=""><figcaption></figcaption></figure>

#### **Step 3**

{% hint style="info" %}
**Building a metafield!** This step is necessary to link new data with the corresponding product in your admin and display this information on the storefront.
{% endhint %}

Create a metafield definition by pressing the **"Add definition"** button in your *Shopify admin -> Settings -> Metafields and metaobjects -> Metafield definitions -> Products*. Read about the metafield definition [<mark style="color:blue;">here</mark>](https://help.shopify.com/en/manual/custom-data/metafields).

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2F8fVeOVWCRDa8pwaHW2pW%2Fsettings_meta.png?alt=media&amp;token=5399261c-00e4-41eb-b0a6-28059c0d8a9d" alt=""><figcaption></figcaption></figure>

View the example of the metafield definition below:

* Name - **Item 1**
* Namespace and key - **custom.item\_1**
* Metaobject - **Additional details**
* **One entry**

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FA7o2Au5pyKkURP97NwrT%2Fmetafields_additional%20details.png?alt=media&amp;token=ac6b5ea6-e9d3-42f4-ad70-f55b6de453c4" alt=""><figcaption></figcaption></figure>

If you need to display several content blocks with various content per product, add additional metafield definitions. We created three metafields to display three content lines on a product page.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FOAGXlmQiUjlG4MrpzU2n%2Fmetafield_definitions.png?alt=media&amp;token=e6857f68-1e9c-4502-b4f3-ee803acf769f" alt=""><figcaption></figcaption></figure>

#### **Step 4**

Link metafields with products in your *Shopify admin -> Products -> Product metafields*. Select a metaobject entry for each metafield to show several content lines on the storefront.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FkgnCuf40MKVexEO06WMz%2Fmetafield_product.png?alt=media&amp;token=4e9fff88-e529-4399-ab89-13c93c171d65" alt=""><figcaption></figcaption></figure>

#### **Step 5**

In your *Shopify admin -> Online Store*, press the **"Customize"** button next to the desired theme. Then, go to *Products -> Product details* in the Theme Editor. In the provided section, hover over the space between blocks, press the **"Add block"** button, and select the **"Icon with text"** block.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FK9IlCOpnYFCrzbhxcW9I%2Fproducts_icon%20with%20text_add.png?alt=media&amp;token=c9f32c22-dd27-400d-b78c-fbdadfc8b043" alt=""><figcaption></figcaption></figure>

Now you can link each metafield with the corresponding content.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FZdQtxRjL1YHxZgFdaHmx%2Fmetaobject_product.png?alt=media&amp;token=25d9fe94-9392-4d99-ab84-97b53560489e" alt=""><figcaption></figcaption></figure>

***

### Build pages using metaobjects

{% embed url="<https://www.youtube.com/watch?v=WsG1rR5A17g>" %}

You can certainly use the traditional method of creating new pages using templates, as described on the following [<mark style="color:blue;">help page</mark>](/unicorn-shopify-theme/faq/how-to-create-a-template.md).

However, if you need to build multiple pages of the same category with identical sections and blocks but unique content on each page, **metaobject templates** can help you create and manage them quickly and efficiently in bulk.

Metaobject templates can be used to create pages with information about vendors, artists, and shop locations to identify sales spots where specific products are located, and more. In our example, we created three pages featuring information about the artists whose work is showcased in the store.

Let's go through a step-by-step guide on how to use metaobject templates:

#### **Step 1**

First, add a metaobject. In your Shopify admin, go to *Settings -> Metafields and metaobjects -> Metaobject definitions* and press the **"Add definition"** button.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FYn9LPZaIaqTrcTfUe9ZW%2Fmetaobjects_add.png?alt=media&amp;token=e2050d81-ef6b-4f5a-bce3-f8b4cc9ccdf3" alt=""><figcaption></figcaption></figure>

Create a metaobject definition by adding its name and fields. Add as many fields as necessary to display the desired content on the storefront, such as text, images, links, etc.

This example demonstrates a definition with the name "Artist" and four fields:

**First field.** The first field is set to display an artist's name. So, it is created using the following parameters:

* Name - **Artist name**
* **Single line text** - **One value**

**Second field.** The next field is added to display a text paragraph with the main description about an artist:

* Name - **About artist**
* **Multi-line text**

**Third field.** Add a field with the following parameters to display an image:

* Name - **Image**
* **File** - **One file**

**Fourth field.** Select the "URL" type to create a field for the link:

* Name - **Link**
* **URL** - **One value**

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FdVN5UvQXlIx8C4cG3QYO%2Fmetaobject_artist.png?alt=media&amp;token=4efe9a61-86ce-492f-8c19-e5c536f73cc2" alt=""><figcaption></figcaption></figure>

#### **Step 2**

To store and organize content that will be displayed on the storefront, add metaobject entries. In the Shopify admin, navigate to *Content -> Metaobjects* and click the definition name. Then, press the **"Add entry"** button.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FbwrtOpbewUlZdy6ArynF%2Fmetaobject_artist_entry.png?alt=media&amp;token=c3ab1592-8cb7-4247-aa0d-a3e561444386" alt=""><figcaption></figcaption></figure>

Create as many entries as needed by editing the provided fields, such as:

* Artist name - artist's name.
* About artist - add some description.
* Image - add an image.
* Link

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2Fb0CFszB4sRB6DGaLpTCJ%2Fadmin_metaobject%20entry%201.0.png?alt=media&amp;token=512fb92a-1710-4322-ab59-6be9e1d3e74d" alt=""><figcaption></figcaption></figure>

We want to display three pages featuring artists, so we've added three entries, each corresponding to a different artist.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FBMUz0NKP3CJaey4Sl6gp%2Fadmin_add%20entries_artists.png?alt=media&amp;token=e937e30d-6ea8-4376-8d51-e517cb311a96" alt=""><figcaption></figcaption></figure>

#### **Step 3**

1. Add a metaobject template in the Theme Editor using the top selector.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2Fnu8V4sdI8ecGsctV6gtk%2Fmetaobject%20template.png?alt=media&amp;token=323e0b09-161d-4689-8852-40c6956cab43" alt=""><figcaption></figcaption></figure>

2. In the opened pop-up, specify the metaobject definition, such as "Artists".
3. Then, edit the provided fields with the corresponding information if necessary:

* Page title
* Meta description
* URL handle

4. Next, click the **"Create template"** button.

#### **Step 4**

To navigate to the desired template, select it from the top drop-down menu.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2F90D6rc6OMzBTi4SvWP8F%2Fmetaobject%20template_artists.png?alt=media&amp;token=91f71222-e75e-4404-adf6-7108dfdc3ddd" alt=""><figcaption></figcaption></figure>

Now you can customize the page with the required content by selecting the appropriate section with blocks.

1. Press the **"Add section"** button in the **"Template"** and select a section. The "Media with text" template is used as an example.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2F37hjMsh6WrGlTIjZhP5R%2Fmetaobject%20template_add%20section.png?alt=media&amp;token=b34e04d2-9fbf-4d61-a157-7e24a42ec6a0" alt=""><figcaption></figcaption></figure>

2. Specify content in the corresponding block by hitting the dynamic source icon.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FpyJYl5PUC7LEOecMfBRk%2Fmetaobject%20template_source%20icon.png?alt=media&amp;token=0d10f66b-9341-4fd8-9dd4-df92fbdae4f1" alt=""><figcaption></figcaption></figure>

Repeat the same steps to assign content to all the desired blocks, such as heading, description, image, link, and so on.

3. Press the drop-down at the top-left corner to select and navigate to other pages.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FjSCSBsHUSl9IZVv7sEIk%2Fmetaobject%20template_change%20page.png?alt=media&amp;token=8de1dde9-c19d-4ade-8e2c-51721c3517ec" alt=""><figcaption></figcaption></figure>

***

### Display content in sections using the metaobjects

Metaobjects are useful for adding the same content to dynamic sections across different parts of a store, helping you avoid the repetitive task of adding information to each block when using multiple blocks in a section.

Additionally, with metaobjects, you only need to edit the information in the entries once, and it will automatically update in the corresponding sections throughout the store.

Let's take a closer look at how it works.

#### Scenario 1:  Bulk adding content to a section

#### **Step 1 and Step 2**

You can use an existing metaobject or add a new one in your *Shopify admin -> Settings -> Metafields and metaobjects -> Metaobject definitions* by pressing the **"Add definition"** button. To create a new metaobject definition with entries, follow [<mark style="color:blue;">Step 1</mark>](#step-1-1) and [<mark style="color:blue;">Step 2</mark>](#step-2) above.

We will use the same metaobject created earlier to display information about artists.

#### **Step 3**

Now, create a metafield to connect metaobjects with theme sections. To handle this configuration, navigate to *Shopify admin -> Settings -> Metafields and metaobjects -> Metafield definitions.* Here, you can add metafields for any page category, such as Products, Collections, Pages, and so on. Select the page category where you want to display the content.

In our example, we want to represent all artists on a single page. So, we will build a Page metafield definition.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FegRQPuBaFgaxrIbywDSj%2Fmetafields_pages.png?alt=media&amp;token=9241671a-f4fb-40f3-9e47-5ec574ea0dce" alt=""><figcaption></figcaption></figure>

Add a metafield definition by pressing the **"Add definition"** button. An example of the metafield definition can be viewed below:

* Name - **Artists**
* Namespace and key - **custom.artists**
* **Metaobject** - **Artist**
* **Type - List - Artist** (As we need to display several artists on a page, we use the "List" option)

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FwT0tSJvlSqmL2DDiB3EP%2Fmetafield%20definition_artists.png?alt=media&amp;token=1be86262-2cca-45e7-9c5d-27db6afe9495" alt="" width="562"><figcaption></figcaption></figure>

#### **Step 4**

In this step, you can use a default page or create a new template and assign it to a page.

**Variant 1:** Create a new template

1. To add a new template in the Theme Editor, click the drop-down menu at the top and select the **"Pages"** category or any other relevant category. Then, press the **"Create template"** button.  For more details, refer to the following [<mark style="color:blue;">help page</mark>](/unicorn-shopify-theme/faq/how-to-create-a-template.md).

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FMBp2Z8l1Db3OEO5SKojP%2Ftemplate_artists.png?alt=media&amp;token=a0a84d09-66f3-4b45-a0e2-0d32a971ce71" alt=""><figcaption></figcaption></figure>

2. Create a new page or use the one you've already created. Navigate to *Shopify admin -> Online Store -> Pages* and add a new page. Read the details in the initial [<mark style="color:blue;">documentation</mark>](https://help.shopify.com/en/manual/online-store/add-edit-pages).
3. Assign a template to the page.

**Variant 2:** Use the existing page. Select a page in *Shopify admin -> Online Store -> Pages*.

Then, follow the steps below regardless of the variant used above:

1. On the opened page, press the **"View all"** button in the "Metafields".

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FgAW2yC4viK0RRXUGQW3z%2Fadmin_pages_artists.png?alt=media&amp;token=e2ca3263-e480-4fde-8fb9-41e51498b67f" alt=""><figcaption></figcaption></figure>

2. Assign all entries to a metafield.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FaepIx2lracDIOmyRjHrW%2Fadmin_pages_add%20artists.png?alt=media&amp;token=2524bbfc-8469-493a-8c70-ae7084a97dc3" alt=""><figcaption></figcaption></figure>

Save the changes.

#### **Step 5**

Link the content with a section:

1. Go to the Theme Editor and select a corresponding page.
2. Then, add a section from the list. In our example, we will use the "Multicolumn" section with the "Column" block.
3. In each block, reference a metaobject by pressing the dynamic source icon.

{% hint style="warning" %}
**Note!** Shopify needs some time to update the information, or several refreshes.
{% endhint %}

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2F5PllpORXB4TAFlgTgV7V%2Fmetaobject%20template_artists%20page.png?alt=media&amp;token=1788a18e-0023-4b32-9441-fedc09e0f87a" alt=""><figcaption></figcaption></figure>

#### Scenario 2:  Display unique information on a specific page of the same category

Another scenario is when you need to place unique content per page. For instance, you may want to feature information about artists, vendors, or store locations on pages within the same category, with content that dynamically changes based on the relevant page. This can also be accomplished using metaobjects.

This example demonstrates how to showcase artists on collection pages where their products are featured. For this, we utilize the same metaobject as before.

#### Step 1 and Step 2

We will skip [<mark style="color:blue;">Step 1</mark>](#step-1-1) and [<mark style="color:blue;">Step 2</mark>](#step-2) since you can refer to the above to learn how to build a metaobject. Instead, we will move on to the next step: creating a metafield.

#### Step 3

Since the goal is to display artists on specific collection pages, we'll create a metafield associated with the collections. To do this, go to *Shopify admin -> Settings -> Metafields and metaobjects -> Metafield definitions*, and select **"Collections"**. If you need to display content on another page category, create a metafield for the corresponding page by selecting it in the list. Then, follow the guidance described below.

Press the **"Add definition"** button. An example of the metafield definition can be viewed below:

* Name - Artist
* Namespace and key - **custom.artist**
* **Metaobject** - **Artist**
* **One entry** (As the only artist will be linked to a metafield on the specific collection page)

Save the settings.

#### Step 4

Link a metafield with a page, such as collections, by going to the *Shopify admin -> Products -> Collections*. In this step, you can assign the exact content you need to showcase on a specific collection using the metaobject entries.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FgcK5USKO497360XMLxUu%2Fadmin%20collections_artist.png?alt=media&amp;token=053cf7cd-9c7e-4c05-b1be-e37219a32ef8" alt=""><figcaption></figcaption></figure>

#### Step 5

Once you have completed all the necessary settings in the admin, proceed to the Theme Editor and associate the content with a section. In the Theme Editor, select a page (for example, **"Collections"**) and add a section. Then, connect content by pressing the dynamic source icon next to each field.

In this example, we used the "Media" section.

<figure><img src="https://2943342198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FysL5Hr1ZCl3x5RHWgJ3m%2Fuploads%2FervTX0MPM43nxhjnW9Fa%2Fcollections_add%20artist.png?alt=media&amp;token=0ce61c62-b9a1-42d7-b671-1027ddc02ae8" alt=""><figcaption></figcaption></figure>
