How to Display Custom Product Data Using Shopify Metafields and Liquid

Shopify provides a flexible platform for building and managing online stores, but its standard product fields may not always include every detail a business needs to display. A fashion store might want to show fabric composition and care instructions, while an electronics store may need to display technical specifications, warranty information, or compatibility details. Adding all this information directly to product descriptions can make content difficult to manage and product pages harder to maintain.

Shopify Metafields solve this problem by allowing store owners to add custom fields to products, variants, collections, customers, and other Shopify resources. When combined with Shopify Liquid, metafields can display dynamic product information directly on storefront pages without manually editing every product template.

In this guide, we’ll explain how Shopify Metafields work, how to create custom product fields, and how to use Liquid code to display the information in your Shopify theme. You’ll also learn how to show variant-specific data, build product specification tables, and troubleshoot common metafield issues.

What Are Shopify Metafields?

Shopify Metafields are custom fields that extend the standard data available in your Shopify store. They let you store additional information that does not fit into Shopify’s default product fields.

For example, a standard Shopify product includes fields such as title, description, price, images, and inventory. But a store may also need additional information, including:

  • Product material or fabric composition
  • Product dimensions and weight
  • Warranty duration
  • Care and washing instructions
  • Ingredient lists
  • Technical specifications
  • Product compatibility
  • Delivery or installation details
  • Variant-specific information

Instead of adding these details manually to product descriptions, you can create dedicated metafields and manage their values from the Shopify admin.

A metafield generally includes a namespace, a key, a data type, and a value. The namespace and key identify the field, while the data type determines what kind of information it stores.

For example:

  • Namespace: custom
  • Key: material
  • Type: Single-line text
  • Value: 100% Organic Cotton

In Liquid, you can access this field using:

{{ product.metafields.custom.material.value }}

Shopify’s custom data documentation explains that metafields add information to existing Shopify resources, while metaobjects are useful for creating independent, reusable data records. https://shopify.dev/docs/apps/build/custom-data

Why Use Metafields for Custom Product Data?

Metafields are useful when you want to make product pages more informative without creating complicated product descriptions or separate templates for every item.

1. Display More Detailed Product Information

A product description is not always the best place for structured information. Metafields allow you to store details such as size, weight, material, ingredients, and warranty information in separate fields.

You can then display these details in organized sections, tables, tabs, or product information blocks.

2. Manage Product Content More Easily

Once metafield definitions are created, store administrators can enter information directly from the product editor. You do not need to modify theme code every time a product’s specifications change.

For stores with many products, this can make content management significantly easier.

3. Create Dynamic Product Page Sections

Liquid can retrieve metafield values and display them dynamically. The same theme section can show different specifications for different products, depending on the values saved in each product’s metafields.

4. Support Different Product Variants

Some products have different information depending on their selected variant. For example, a large product may have different dimensions from a small one, or different colors may have different material details.

Variant metafields let you store this information separately for each variant.

5. Build More Flexible Shopify Themes

Theme developers can use metafields to create reusable product information sections. This helps create product pages that are easier to maintain and customize as a store grows.

Step 1: Create Product Metafield Definitions in Shopify

Before adding Liquid code, you need to create the metafield definitions that will hold your custom product information.

Follow these steps:

  1. Log in to your Shopify admin.
  2. Go to Settings.
  3. Open Custom data (the label or navigation location may vary slightly).
  4. Select Products.
  5. Click Add definition.
  6. Enter a name for your metafield.
  7. Choose a namespace and key.
  8. Select an appropriate content type.
  9. Save the definition.

For example, if you want to display product material, you can create a definition like this:

SettingExample
NameMaterial
Namespace and keycustom.material
Content typeSingle line text
Example value100% Organic Cotton

You can create additional definitions for product weight, dimensions, warranty, care instructions, and other information.

Choose the correct data type: Use text fields for simple descriptions, numbers for measurements, true/false for yes-or-no values, and appropriate reference or structured types when the information is more complex. Defined metafields provide a typed editing experience and can support validation and other Shopify features. https://shopify.dev/docs/apps/build/custom-data

Step 2: Add Custom Data to Your Products

After creating metafield definitions, add values to individual products.

  1. Open Products in Shopify admin.
  2. Select a product.
  3. Scroll down to the Metafields area.
  4. Find the custom fields you created.
  5. Enter the relevant product information.
  6. Save the product.

For example, a clothing product might contain:

MetafieldExample value
Material100% Organic Cotton
FitRegular Fit
Care InstructionsMachine wash cold
Country of OriginBangladesh
Warranty30 Days

You can enter different values for each product. The theme will then display the information associated with the product currently being viewed.

Step 3: Display Product Metafields Using Shopify Liquid

Shopify Liquid is the template language used to display dynamic store data. You can use Liquid objects to access metafields and output their values in your theme.

For example, if you created a product metafield with the namespace and key custom.material, use:

{{ product.metafields.custom.material.value }}

This code retrieves the material information saved for the current product.

Add a Conditional Check

Not every product will necessarily have a value for every metafield. To avoid displaying an empty heading or blank section, check whether the field contains a value before showing it.

{% if product.metafields.custom.material.value != blank %}
  <p>
    <strong>Material:</strong>
    {{ product.metafields.custom.material.value }}
  </p>
{% endif %}

This approach keeps product pages clean because the material information appears only when a value is available.

Display Multiple Product Metafields

You can use the same approach for several fields:

{% if product.metafields.custom.material.value != blank %}
  <p>
    <strong>Material:</strong>
    {{ product.metafields.custom.material.value }}
  </p>
{% endif %}

{% if product.metafields.custom.fit.value != blank %}
  <p>
    <strong>Fit:</strong>
    {{ product.metafields.custom.fit.value }}
  </p>
{% endif %}

{% if product.metafields.custom.warranty.value != blank %}
  <p>
    <strong>Warranty:</strong>
    {{ product.metafields.custom.warranty.value }}
  </p>
{% endif %}

Make sure the namespace, key, and metafield type match the definitions in your Shopify admin. Using .value is important when you need the actual stored value, particularly for typed metafields such as boolean fields. https://community.shopify.com/t/displaying-and-calculating-metafields-in-liquid/250398

Step 4: Create a Product Specification Table

A specification table is a useful way to organize custom product information. Instead of showing each metafield as a separate paragraph, you can present the details in a consistent table.

For example, an electronics store could display model, material, dimensions, weight, and warranty information in one section.

Add the following Liquid and HTML code to an appropriate product template or custom Liquid section:

{% assign has_specs = false %}

{% if product.metafields.custom.material.value != blank
  or product.metafields.custom.weight.value != blank
  or product.metafields.custom.dimensions.value != blank
  or product.metafields.custom.warranty.value != blank %}
  {% assign has_specs = true %}
{% endif %}

{% if has_specs %}
  <div class="product-specifications">
    <h3>Product Specifications</h3>

    <table>
      <tbody>
        {% if product.metafields.custom.material.value != blank %}
          <tr>
            <th>Material</th>
            <td>{{ product.metafields.custom.material.value }}</td>
          </tr>
        {% endif %}

        {% if product.metafields.custom.weight.value != blank %}
          <tr>
            <th>Weight</th>
            <td>{{ product.metafields.custom.weight.value }}</td>
          </tr>
        {% endif %}

        {% if product.metafields.custom.dimensions.value != blank %}
          <tr>
            <th>Dimensions</th>
            <td>{{ product.metafields.custom.dimensions.value }}</td>
          </tr>
        {% endif %}

        {% if product.metafields.custom.warranty.value != blank %}
          <tr>
            <th>Warranty</th>
            <td>{{ product.metafields.custom.warranty.value }}</td>
          </tr>
        {% endif %}
      </tbody>
    </table>
  </div>
{% endif %}

You can style the table with CSS:

.product-specifications {
  margin-top: 24px;
}

.product-specifications h3 {
  margin-bottom: 12px;
}

.product-specifications table {
  width: 100%;
  border-collapse: collapse;
}

.product-specifications th,
.product-specifications td {
  padding: 12px;
  border-bottom: 1px solid #e5e5e5;
  text-align: left;
}

.product-specifications th {
  width: 35%;
  font-weight: 600;
}

This example checks whether any specification has a value before displaying the section. Each row is also conditional, so empty fields do not create unnecessary rows.

Remember to create all four metafield definitions using the exact namespace and keys shown in the code, or update the code to match your own definitions.

Step 5: Display Variant-Specific Metafields

Shopify products can have multiple variants, such as different sizes, colors, or materials. Sometimes each variant needs its own information.

For example:

  • Small: 20 cm × 15 cm
  • Medium: 25 cm × 18 cm
  • Large: 30 cm × 22 cm

A product-level metafield would show the same information for every variant. Instead, create a metafield definition under Settings → Custom data → Variants.

For example:

  • Name: Variant Dimensions
  • Namespace and key: custom.dimensions
  • Type: Single line text

Then add a different value to each variant in the product editor.

In Liquid, you can access the selected or current variant’s metafield through:

{% if product.selected_or_first_available_variant.metafields.custom.dimensions.value != blank %}
  <p>
    <strong>Dimensions:</strong>
    {{ product.selected_or_first_available_variant.metafields.custom.dimensions.value }}
  </p>
{% endif %}

This displays the dimensions belonging to the initially selected or first available variant.

Make Variant Information Update When Customers Change Options

One important detail: Liquid renders the page on the server. When a customer selects another variant, Shopify themes commonly update the price, availability, and featured media with JavaScript. A Liquid-rendered metafield value does not automatically update just because the selected variant changes.

To make variant-specific metafield information update dynamically, your theme needs to provide the variant data to JavaScript and update the relevant HTML when the selected variant changes.

A simplified example is:

<div id="variant-dimensions">
  {{ product.selected_or_first_available_variant.metafields.custom.dimensions.value }}
</div>

<script type="application/json" id="variant-data">
[
  {% for variant in product.variants %}
    {
      "id": {{ variant.id | json }},
      "dimensions": {{ variant.metafields.custom.dimensions.value | json }}
    }{% unless forloop.last %},{% endunless %}
  {% endfor %}
]
</script>

You can then use JavaScript to find the selected variant and update the displayed value:

const variantDataElement = document.getElementById('variant-data');
const dimensionsElement = document.getElementById('variant-dimensions');

if (variantDataElement && dimensionsElement) {
  const variants = JSON.parse(variantDataElement.textContent);

  function updateVariantDimensions(variantId) {
    const selectedVariant = variants.find(
      variant => String(variant.id) === String(variantId)
    );

    dimensionsElement.textContent =
      selectedVariant?.dimensions || '';
  }

  document.addEventListener('change', function (event) {
    const variantInput = event.target.closest(
      'form[action*="/cart/add"] [name="id"]'
    );

    if (variantInput) {
      updateVariantDimensions(variantInput.value);
    }
  });
}

This is a simplified illustration, not a universal drop-in solution. Shopify themes handle variant selection differently. Some use a select element, while others use radio buttons or custom variant-picker components. You may need to connect the update function to your theme’s existing variant-change event to ensure it works reliably.

Storetasker’s guide discusses the challenge of displaying variant-specific metafields and updating the information when customers select different variants. https://www.storetasker.com/blog/displaying-variant-specific-information-with-metafields

Step 6: Display Image, URL, and Other Metafield Types

Metafields are not limited to simple text. Shopify supports different data types, so you can create richer product experiences.

Display an Image Metafield

If you create an image-type product metafield, you can display the selected image with Liquid:

{% assign custom_image = product.metafields.custom.product_image.value %}

{% if custom_image != blank %}
  <img
    src="{{ custom_image | image_url: width: 800 }}"
    alt="{{ product.title | escape }}"
    width="800"
    height="800"
    loading="lazy"
  >
{% endif %}

Replace custom.product_image with your actual namespace and key.

Display a URL Metafield

A URL metafield can be useful for linking to a size guide, instruction manual, or additional product resource.

{% if product.metafields.custom.manual_url.value != blank %}
  <a
    href="{{ product.metafields.custom.manual_url.value }}"
    target="_blank"
    rel="noopener"
  >
    View Product Manual
  </a>
{% endif %}

Display a True/False Metafield

A boolean metafield can control whether a product feature or message appears.

{% if product.metafields.custom.is_eco_friendly.value == true %}
  <p class="product-label">Eco-Friendly Product</p>
{% endif %}

This is useful for badges such as eco-friendly, handmade, limited edition, or free shipping eligibility. Make sure the metafield is defined as a true/false type.

Step 7: Use Metafields with Shopify Theme Editor Dynamic Sources

You do not always need to write Liquid code to display metafields. Many modern Shopify themes support dynamic sources in the theme editor.

Dynamic sources connect a theme setting or section block to store data such as product metafields.

To use this feature:

  1. Open Online Store → Themes.
  2. Click Customize on your active theme.
  3. Navigate to a product template.
  4. Select a section or block that supports dynamic sources.
  5. Look for the dynamic source icon beside a compatible setting.
  6. Select the metafield you want to display.
  7. Save your changes.

For example, you may connect a product’s material metafield to a text block or a product image metafield to an image setting.

The available dynamic sources depend on the theme and the setting type. If your theme does not support the layout or display you want, you can build a custom Liquid section.

Step 8: Organize Complex Product Data with Metaobjects

When product information becomes more complex, metafields alone may not be the most convenient solution.

For example, a product might have a list of ingredients, a collection of technical specifications, or several care instructions. If the same structured information is reused across many products, Shopify metaobjects can help.

A metafield adds data to an existing resource, while a metaobject defines a reusable record with its own fields. You can then connect a product metafield to a metaobject or a list of metaobjects.

Consider a clothing store that uses the same care instructions across multiple products. Rather than rewriting the instructions for each product, you could create a reusable care-instructions metaobject and reference it from relevant products.

Shopify recommends choosing between metafields and metaobjects based on whether the information describes an existing resource or represents a separate reusable record. https://shopify.dev/docs/apps/build/custom-data

Common Shopify Metafield and Liquid Problems

Even when metafields are configured correctly, they may not appear as expected. Here are some common issues and ways to troubleshoot them.

1. Incorrect Namespace or Key

A metafield may not display if the namespace or key in your Liquid code does not match the definition.

For example, custom.material and custom.product_material are two different fields.

Solution: Open the metafield definition in Shopify admin and verify the exact namespace and key.

2. Missing .value

For typed metafields, use .value when you need the stored value.

Example:

{{ product.metafields.custom.material.value }}

For a boolean condition:

{% if product.metafields.custom.is_eco_friendly.value == true %}
  <p>Eco-Friendly</p>
{% endif %}

Shopify Community discussions highlight how checking the metafield value correctly can resolve conditions that otherwise fail to behave as expected. https://community.shopify.com/t/displaying-and-calculating-metafields-in-liquid/250398

3. Metafield Has No Value

If a product does not have a saved value, Liquid may output nothing.

Solution: Add a value to the product in Shopify admin and use a conditional check to prevent empty content from appearing.

4. Wrong Resource Type

Product metafields and variant metafields belong to different Shopify resources.

For example:

product.metafields.custom.material.value

accesses a product metafield, while:

variant.metafields.custom.material.value

accesses a variant metafield when variant refers to the relevant variant object.

Solution: Confirm where the metafield definition was created and use the matching Liquid object.

5. Variant Data Does Not Update

A metafield may display correctly when the product page first loads but remain unchanged after a customer selects another variant.

Solution: Use JavaScript to update the displayed value when the selected variant changes. Connect it to the theme’s existing variant-selection behavior.

6. Unsupported or Incorrect Data Handling

Some metafields return structured values or references rather than plain text. Treating every metafield as a simple string can lead to unexpected output.

Solution: Check the metafield’s data type and use the appropriate Liquid properties and filters. For reference fields, access the referenced resource or its relevant properties rather than assuming the value is plain text.

Best Practices for Using Shopify Metafields

To build a reliable and maintainable Shopify store, follow these practices:

  • Use clear names: Choose descriptive names such as Material, Warranty, Dimensions, and Care Instructions.
  • Keep namespace and keys consistent: A predictable naming structure makes Liquid code easier to maintain.
  • Choose the correct data type: Use text, numbers, booleans, files, references, and other types according to the information being stored.
  • Use conditional Liquid statements: Avoid showing empty labels and sections.
  • Separate product and variant information: Store shared product details at the product level and variant-specific details at the variant level.
  • Avoid unnecessary duplication: Use metaobjects when information needs to be reused as a structured record.
  • Test on different products: Check products with complete, partial, and missing metafield values.
  • Test variant selection: Make sure custom information updates correctly when customers change product options.
  • Keep the design responsive: Specification tables and custom product sections should work on mobile devices.
  • Maintain accessibility: Use meaningful headings, readable labels, and appropriate alternative text for images.

How Custom Metafields Improve the Shopify Shopping Experience

Well-organized product information helps customers understand what they are buying. When shoppers can quickly find dimensions, materials, compatibility, warranty details, or care instructions, they may feel more confident about their purchase.

Metafields also help businesses maintain consistent product pages. Instead of manually formatting every product description, store owners can enter information into structured fields and let the theme display it in a consistent layout.

For Shopify theme developers, this creates opportunities to build flexible product templates with reusable sections, specification tables, badges, image blocks, and variant-specific information.

A well-designed Shopify theme should make it easy to present this information without cluttering the product page or slowing down the shopping experience.

Shopify Metafields and Liquid provide a powerful way to display custom product data and build more flexible product pages. By creating metafield definitions, adding values to products, and accessing those values through Liquid, you can show specifications, materials, warranty details, images, and other information exactly where customers need them.

For simple product details, Shopify’s theme editor and dynamic sources may be enough. For more advanced layouts, Liquid allows developers to create custom sections and specification tables. If your store needs variant-specific content, combine Liquid with JavaScript so the displayed information changes when customers select different options.

Whether you manage a small catalog or a large ecommerce store, using Shopify Metafields thoughtfully can make product data easier to manage and your storefront more informative, consistent, and user-friendly.

At Themetidy, we believe a flexible Shopify theme should help merchants present product information clearly while keeping the storefront easy to navigate and customize.

Founder & Shopify Expert
15+ Years of Experience

Ready to Build Your High-Converting Shopify Store?

Get a free store review and custom growth plan from a 15+ year Shopify expert.

Free Store Audit

Detailed analysis of your store performance

Actionable Plan

Step-by-step plan to increase sales & conversions

Expert Support

15+ years of Shopify experience by your side

15+

Years of Experience (Since 2010)

500+

Stores Built Worldwide

$100M+

Revenue Generated for Our Clients*

30+

Countries We Serve