Skip to main content

Metafields in Aqua / Liquid

Every owner that supports metafields exposes a metafields drop on its Aqua/Liquid object. Access follows the standard {owner}.metafields.{namespace}.{key} pattern, so theme code that reads metafields stays portable. For the full data model (types, owners, validations, REST API), see Metafields Overview.

The basic pattern

{{ … }} triggers toString() on the metafield drop, which renders type-aware (see render rules below). .value returns the decoded value (number, array, object, …). .type returns the type string. Missing namespaces and missing keys return an empty drop{{ … }} prints empty string, {% if … %} is falsy, no exception is thrown. This makes it safe to reference fields that may not exist on every resource.

Owners

OwnerDrop
Account / storeshop.metafields
Productproduct.metafields
Variantvariant.metafields
Collectioncollection.metafields
Customercustomer.metafields
Orderorder.metafields
Pagepage.metafields
Blogblog.metafields
Articlearticle.metafields

Render rules per type

{{ metafield }} (without .value) calls a type-aware toString:
Type{{ mf }} renders{{ mf.value }} returns
single_line_text_field / multi_line_text_fieldstringstring
rich_text_field (alias rich_text)raw HTML, unescapedraw HTML string
number_integerintegernumber
number_decimaldecimalnumber
boolean"true" or "false"bool
color"#RRGGBB"string
date / date_timeISO stringstring
urlURL stringstring
weight / dimension / volume"<value> <unit>"{ unit, value }
money{amount, currency_code} (use | money filter)object
rating{value, scale_min, scale_max}object
file_referenceURL stringURL string
*_reference (other)id stringid string (or resolved drop, if resolver wired)
list.*iterable array of value-dropsarray
json / json_stringstringified JSONparsed value

Examples

Text and numbers

Rich text (HTML)

The rich_text_field type renders the stored HTML unescaped — perfect for care instructions, warnings, formatted descriptions:

Boolean conditionals

Lists

Money

Measurements

Color

Date

Reference (file)

JSON

Defensive access

Use {% if %} to guard optional fields — missing keys are falsy:
Or fall back with default:

Across owner types

Same access pattern, every owner:

Performance

Metafields are bulk-loaded server-side alongside the parent resource — one query loads the resource, one query loads all its metafields, and both are cached together. There is no per-field network round-trip from Liquid. When a metafield is written via the REST API, the relevant caches are invalidated automatically. The next render sees the new value within ~1 second.

See also