Skip to content

metafield

A typed custom field attached to a product, variant, collection, page, article, blog, order, customer, shop, or pickup-availability location. Access it through the owner’s metafields.namespace.key path, then read value. Metaobject authored fields use metaobject.FIELD_KEY directly; they are metafield values but do not live under metaobject.metafields.

Access

{% assign care = product.metafields.information.care_instructions %}
{% if care %}
<h2>Care instructions</h2>
{{ care.value }}
{% endif %}

If the namespace or key is missing, unpublished, unsupported for storefront use, or not owned by the current resource, the lookup returns Liquid nil. The object never falls through to a backend row or definition record.

Examples

Scalar and list values

{{ product.metafields.details.material.value }}
{% assign ingredients = product.metafields.details.ingredients %}
{% if ingredients.list? %}
<ul>
{% for ingredient in ingredients.value %}
<li>{{ ingredient }}</li>
{% endfor %}
</ul>
{% endif %}

Example output:

Organic cotton
<ul><li>Cotton</li><li>Natural dye</li></ul>

Reserved namespace or key names

Use bracket notation when a merchant-defined name could be interpreted as a Liquid collection helper:

{{ product.metafields['details']['size'].value }}
{{ product.metafields['details']['first'].value }}

Resource references

Reference values resolve to the same audited Drop objects used elsewhere in Liquid:

{% assign guide = product.metafields.content.buying_guide.value %}
{% if guide %}
<a href="{{ guide.url }}">{{ guide.title }}</a>
{% endif %}

Lists of product, variant, collection, page, article, and metaobject references are loaded in one request-scoped batch. Preserve the list order authored by the seller.

Privacy boundary: customer-reference metafield values are intentionally redacted from public storefront Liquid, including references nested through a metaobject. They resolve to nil. This is a deliberate Sellerlane security difference from Shopify’s broader Liquid metafield visibility.

Properties

PropertyDescription
metafield.list?true when the metafield value is a list type.
metafield.typeNormalized metafield type, such as single_line_text_field, product_reference, or list.metaobject_reference.
metafield.valueThe value.

Property list is generated from the storefront engine (MetafieldItemDrop), so it always matches what your theme can use. Use {{ metafield | json }} only as a curated debug snapshot; it can omit lazy or otherwise public properties.