k-sync
Zurück zum Blog

Shopify metafield types: complete reference for WooCommerce migrators (2026)

Complete reference for all Shopify metafield types — single_line_text, multi_line_text, number_integer, number_decimal, boolean, color, date, file_reference, list types, metaobject_reference, and when to use each.

·Von k-sync
6 Min. Lesezeit · 1,188 Wörter

WooCommerce custom fields (post meta) were untyped strings — you could store any data in any format. Shopify metafields are typed — each field has a declared type that determines how the value is stored, validated, displayed in the Theme Editor, and queried. Choosing the right type when creating metafield definitions is important: it affects storefront display, Liquid access, Admin UI editing experience, and whether the field can be used as a filter in Search & Discovery. This is the complete reference for every Shopify metafield type.

Text types

TypeUse caseCharacter limitLiquid access
single_line_text_fieldShort labels, specs, namesUnlimited{{ product.metafields.ns.key }}
multi_line_text_fieldParagraphs, care instructions, notesUnlimited{{ product.metafields.ns.key | newline_to_br }}

Number types

TypeUse caseExample value
number_integerCounts, ages, years, whole units42
number_decimalWeights, prices, measurements14.5

Boolean type

Date and time types

TypeFormatUse case
dateYYYY-MM-DDLaunch date, vintage year, expiry date
date_timeISO 8601 with timeEvent datetime, timestamp

Color type

URL type

JSON type

Dimension types

TypeFormatUse case
dimension{ value: 150, unit: "cm" }Height, width, depth
volume{ value: 500, unit: "ml" }Liquid volume, capacity
weight{ value: 1.5, unit: "kg" }Product weight (different from variant weight)

Rating type

File reference types

TypeUse case
file_referenceAny file — PDF, image, video
image_referenceImages only (renders via Shopify CDN)
page_referenceLink to a Shopify page
product_referenceLink to another Shopify product
variant_referenceLink to a specific product variant
collection_referenceLink to a Shopify collection
metaobject_referenceLink to a metaobject record

file_reference in practice

{% assign pdf = product.metafields.ns.manual.value %}
{% if pdf != blank %}
  <a href="{{ pdf | file_url }}" download>Download product manual (PDF)</a>
{% endif %}

product_reference in practice (related product)

{% assign related = product.metafields.ns.compatible_product.value %}
{% if related != blank %}
  <div class="related-product">
    <a href="{{ related.url }}">{{ related.title }}</a>
    {{ related.price | money }}
  </div>
{% endif %}

List types

Every type (except JSON, rating, file types) can be prefixed with list. to store multiple values:

List typeUse caseExample values
list.single_line_text_fieldTags, categories, compatible models["Cotton", "Polyester", "Elastane"]
list.number_integerMultiple numeric values[38, 39, 40, 41, 42]
list.product_referenceMultiple related productsList of product GIDs
list.colorAvailable colour swatches["#2c2926", "#ffffff", "#3a8c9c"]
{% comment %} Rendering a list metafield in Liquid {% endcomment %}
{% for material in product.metafields.ns.materials.value %}
  <li>{{ material }}</li>
{% endfor %}

Metaobject reference

Metaobjects are custom structured records — think custom post types in WordPress. A metaobject_reference metafield links a product to a metaobject record:

Choosing the right type: quick guide

DataRecommended typeWhy
Colour name ("Midnight Navy")single_line_textText, not a hex value
Colour hex for display swatchcolorValidates as hex, renders correctly
Dimensions (H×W×D)single_line_text "75 × 43 × 33 cm"Simpler than dimension type for display
Weight (always in kg)number_decimal key: weight_kgSimpler than weight type
PDF manualfile_referenceStored in Shopify Files, CDN-served
Multiple compatible itemslist.single_line_textArray of text values
Yes/No flagbooleanExplicit true/false, renders as checkbox
Year (e.g., 1987)number_integer or single_line_textInteger if you need to sort; text if display-only
External URLurlValidated format, clean in Liquid
Related productproduct_referenceLinks to actual product object in Liquid

Storefront access setting

The most common metafield type mistake is using single_line_text for everything — it's safe but misses type-specific features. A product_reference metafield gives you the full product object in Liquid (title, price, URL, images) rather than just a product handle string. A file_reference metafield gives you a Shopify CDN URL automatically. A boolean metafield renders as a checkbox in the Admin product editor, which is far less error-prone for merchant editing than a single_line_text field where they have to type "true" or "false". Spend ten minutes on type selection when creating metafield definitions — it pays dividends in both merchant editing experience and Liquid template simplicity.

Verwalten Sie Ihre Produkte mit k-sync

Verbinden Sie Ihren Shop, validieren Sie Produkte, optimieren Sie mit KI und pushen Sie zu Shopify in Minuten. Kostenlos bis zu 50 Produkte.

Kostenlos starten

Weitere Artikel

Alle Migrationsanleitungen ansehen