Skip to content

Dynamic sources and metafields

Merchants define custom fields in Settings › Custom fields and fill them in on each product, collection or page: a subtitle, a care guide, a “made in” country. Themes read them as metafields.

{%- assign subtitle = product.metafields.custom.subtitle -%}
{%- if subtitle != blank -%}
<p class="product__subtitle">{{ subtitle }}</p>
{%- endif -%}

resource.metafields.<namespace>.<key> is a metafield. It prints as its value; .value gives the typed value (a number, a list, a reference), and .type its type.

Metafields are on product, collection, page, article and shop.

In Shopify, a merchant can connect a text setting to a metafield in the editor. Sooquna doesn’t offer this yet. Until it does, read the metafield in your section and fall back to the setting:

{{ product.metafields.custom.badge | default: block.settings.badge_text }}

This works the same for every product and keeps the merchant’s text as the default.

Entries of a custom content type (an author, a store location), managed in Storefront › Custom content, are metaobjects. They can have their own pages; see Metaobject pages. A metaobject setting lets a section pick one entry.

Was this page helpful?