Add Metaobjects to Create a Custom Template in Shopify 2.0

Add Metaobjects to Create a Custom Template in Shopify 2.0

Introduction

Adding metaobjects to create a custom template in Shopify 2.0 is a two part process: first, you define and store your structured content in the Shopify admin, and then you connect that content to your theme using dynamic sources or Liquid. The key is understanding where each step happens, admin setup versus theme implementation and so nothing breaks or becomes hard-coded.

In this guide, you’ll learn how to create a metaobject definition, add entries, attach them to products or pages using a reference metafield, and display them inside a custom template or section. We’ll walk through the exact workflow Shopify expects in 2.0 themes, including when to use the theme editor and when to write Liquid, so your metaobject data stays flexible, reusable, and easy to manage as your store grows.

 

What Are Metaobjects in Shopify?

Metaobjects in Shopify are reusable custom data structures that enable you to store and manage complex, multi-field information beyond standard data, such as products or collections.  For example, you can create a metaobject to store detailed information about product specifications, size charts, or designer profiles, and then use this information in multiple places across your store. Here’s how it works:

  • Metaobjects are used to create and organize rich content that can be reused throughout your store.
  • You can create a metaobject definition for a product highlight and then create multiple entries for different products, each with its own set of unique highlights.
  • These entries can then be displayed on your website by referencing the metaobject through Liquid in your theme or via the Storefront API.
  • Metaobjects are different from simple metafields in that they can contain multiple fields of various types, forming a complex data structure.

If you’re new to custom data in Shopify, it helps to first understand how metafields work, since metaobjects rely on them for reference, this is covered in detail in our guide on how to add metafields in a Shopify store.

Difference Between Metaobjects and Metafields

Metafields are individual pieces of custom data, such as fabric type. Metaobjects are structured containers that group multiple related metafields together to create a new content type, such as a Product Details object that includes fabric type, care instructions, and size availability. Metafields are for simple, single data points, while metaobjects are for more complex data structures, such as author profiles or recipes.


How to Create a Metaobject in Shopify

To create a metaobject in Shopify, navigate to Shopify Admin >Content > Metaobjects or Settings > Metafields and metaobjects in your Shopify admin, click Add definition, give it a name, and then add fields with specific content types like single-line text or image to define the structure. Once you've saved the definition, you can add entries by selecting the definition and filling in the forms for each instance. Follow these steps to create a Metaobject definition and add the entries.

Step 1: Navigate to Shopify Admin > Content > Metaobjects.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 2: Click the Add definition button.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 3: Add the name of your metaobject definition.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 4: Add the label and select the type of field you want to add, such as single-line text, file, or other options.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 5: Click the Add field button to add more fields to your metaobject definition.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 6: Save the changes.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 7: Click the Add entry button to add the data to the metaobject definition.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 8: Fill the fields and click the save button.

Add Metaobjects to Create a Custom Template in Shopify 2.0



Attach Metaobjects to Products or Pages

To attach metaobjects to products or pages, first create a metaobject definition and then create metafields that reference that definition under the product or page's custom data settings. You can then select the specific metaobject entry you want to link to that product or page in the metafield editor. Follow these steps to attach the Metaobject to your Product page.

Step 1: Navigate to Shopify Admin > Settings.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 2: Scroll down to the Metafields and metaobjects section.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 3: Open the Product Metafields tab.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 4: Click the Add definition button.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 5: Add the name of your definition and select the type of Metafield, such as Metaobject. Select the type, such as a single item or a list.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 6: Select the Metaobject definition from the list you created before.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 7: Save the changes.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 8: Copy this unique identifier of the Metafield.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 9: Navigate to Shopify Admin > Products.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 10: Select the product that you want to update.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 11: Scroll down to the Metafields section.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 12: Select the entries you want to add for this product.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 13: Save the changes.

Add Metaobjects to Create a Custom Template in Shopify 2.0



Create a Custom Template to Display Metaobjects (Shopify 2.0)

To display Metaobjects in Shopify 2.0 using a custom template, follow these steps:

Step 1: Navigate to Online Store > Themes > Duplicate. Duplicate your theme for backup.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 2: Navigate to Online Store > Themes > Customize.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 3: Select the product template from the dropdown.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 4: Click the Create Template button.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 5: Name your template, select the base template, and click the Create Template button.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 6: Add sections or blocks in your Metaobject Template that support dynamic sources.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 7: Click the Connect Dynamic Source button.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 8: Connect your dynamic sources and save the changes.


Add Metaobject data using Custom Section

To display Metaobjects in Shopify 2.0 using a custom section, follow these steps:

Step 1: Navigate to Online Store > Themes > Edit Code.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 2: Navigate to the Sections Folder and create a section named product-spec.liquid.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 3: Add the following code to your file.

    
        {% if product.metafields.custom.products_specs.value != blank %}
        <div class="product-specs-wrapper">
            
            {% for spec in product.metafields.custom.products_specs.value %}
            <div class="product-spec-card">
                
                {% if spec.image != blank %}
                <div class="product-spec-image">
                    <img src="{{ spec.image | image_url: width: 800 }}" alt="{{ spec.heading | escape }}">
                </div>
                {% endif %}

                {% if spec.heading != blank %}
                <h3 class="product-spec-heading">
                    {{ spec.heading }}
                </h3>
                {% endif %}

                {% if spec.text != blank %}
                <div class="product-spec-text">
                    {{ spec.text | metafield_tag }}
                </div>
                {% endif %}

                {% if spec.button_label != blank and spec.button_link != blank %}
                <a href="{{ spec.button_link }}" class="product-spec-btn">
                    {{ spec.button_label }}
                </a>
                {% endif %}

            </div>
            {% endfor %}

        </div>
        {% endif %}
        <style>
            .product-specs-wrapper {
                display: grid;
                grid-template-columns: repeat(3, 1fr);
                gap: 30px;
                margin-top: 40px;
            }
            .product-spec-card {
                border: 1px solid #eee;
                padding: 20px;
                border-radius: 12px;
                background: #fff;
                box-shadow: 0 2px 6px rgba(0,0,0,0.05);
            }
            .product-spec-image img {
                width: 100%;
                border-radius: 10px;
                margin-bottom: 15px;
            }
            .product-spec-heading {
                font-size: 20px;
                margin-bottom: 10px;
                font-weight: 600;
            }
            .product-spec-text {
                font-size: 15px;
                line-height: 1.6;
                margin-bottom: 15px;
            }
            .product-spec-btn {
                display: inline-block;
                background: #000;
                color: #fff;
                padding: 10px 18px;
                border-radius: 6px;
                text-decoration: none;
                transition: 0.2s;
            }
            .product-spec-btn:hover {
                background: #333;
            }
        </style>
        {% schema %}
            {
                "name": "Product Specifications",
                "settings": [],
                "presets": [
                    {
                        "name": "Product Specifications"
                    }
                ]
            }
        {% endschema %}
    

Step 4: Save the changes.

Step 5: Navigate to Online Store > Themes > Customize.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 6: Navigate to the Product page from the dropdown. Click the Add Section button and select the section you created.

Add Metaobjects to Create a Custom Template in Shopify 2.0

Step 7: Save the changes.

Also Read: Add Estimated Delivery Date For Shopify Via Custom Code

Final Thoughts on How to Add Metaobjects to Create a Custom Template in Shopify 2.0

Metaobjects unlock a cleaner, more scalable way to manage dynamic content in Shopify 2.0. Once set up correctly, they reduce duplication, simplify updates, and give you full control over how structured data appears across your store.

If you want help implementing metaobjects, building custom templates, or optimizing your Shopify store for performance and conversions, reach out to our Shopify development team. We’ll help you do it the right way from day one.


Frequently Asked Questions

To create a custom template in Shopify, go to Online Store → Themes → Customize, open the template dropdown, and click Create template. Choose a base template, name it, and save. You can then add sections, connect dynamic sources, and assign the template to specific products or pages.

To add metaobjects in Shopify, navigate to Shopify Admin → Content → Metaobjects, create a metaobject definition, and add your fields. After saving, create entries by filling in the data. These entries can later be linked to products or pages and displayed using Liquid or dynamic sources.

A metaobject template in Shopify defines how metaobject content appears on the storefront. It’s created in the theme editor and allows you to design layouts visually using sections and dynamic data. This makes it easy to reuse the same structured content across multiple pages or products.

Metafields store single pieces of custom data, like a material or size note. Metaobjects group multiple related fields into one structured content type. Metaobjects are ideal for complex content like product specs or FAQs, while metafields work best for simple, standalone values.

Yes, metaobjects can be used on product pages in Shopify 2.0 by creating a metafield that references a metaobject definition. Once attached to a product, you can display the metaobject data using dynamic sources in the theme editor or through custom Liquid sections.

Metaobjects don’t always require custom Liquid code. Many stores can display them using dynamic sources in the Shopify theme editor. However, custom Liquid sections are useful when you need advanced layouts, conditional logic, or more control over how the metaobject content is rendered.

Comments(0)
You don't have any comments yet

Leave a comment
Are You Looking for a Shopify Expert?

We design, develop, optimize, and scale high-converting Shopify stores.

Get in touch
Let's Connect
Shopify Plus eCommerce Development Agency ecomx agency

Looking for a Trusted Ecommerce & Shopify Plus Agency?

We design, develop, optimize, and scale high converting Shopify Ecommerce stores that drive sales.

Get in Touch
Ecomx shopify plus agency about us page Yasin

Looking for a Shopify expert to handle a small task? Shopify Migration Experts Agency Ecomx shopify plus agency

Let’s talk about your project

Shopify Custom Theme Development Services Live Chat