metafields
metafields is a typed, lazy lookup scoped to its owning resource. Access a
namespace and key explicitly:
{{ product.metafields.details.material.value }}The object does not expose namespace/key enumeration or server repository
state. Missing, unpublished, unsupported, and unauthorized reference values
resolve to nil.
Metaobject authored fields use metaobject.FIELD_KEY.value directly. They do
not live under a metaobject.metafields lookup.
Examples
Guard a missing field
{% assign subtitle = product.metafields.content.subtitle %}{% if subtitle %} <p>{{ subtitle.value }}</p>{% endif %}When content.subtitle has not been authored, the block renders nothing. An
unknown namespace behaves the same way.
Work with several owners
{{ product.metafields.specs.material.value }}{{ product.selected_or_first_available_variant.metafields.specs.finish.value }}{{ collection.metafields.content.introduction.value }}Each lookup remains scoped to the resource before the namespace and is tenant-validated by the backend. A product cannot read a variant metafield, and a resource ID from another store cannot be resolved.
Avoid enumeration
{% comment %}Supported: explicit namespace and key{% endcomment %}{{ product.metafields['specs']['material'].value }}
{% comment %}Not supported: enumerating every backend metafield{% endcomment %}{% for namespace in product.metafields %}...{% endfor %}Explicit lookup keeps storefront data bounded and lets the request-scoped metafield loader combine repeated references into bulk API calls.
Properties
| Property | Description |
|---|
This lookup has no static properties. Namespace and key names are dynamic.