How can I access metaobject values in product metafields?

Topic summary

Core Issue:
Developers are struggling to access metaobject values stored in product metafields using Liquid, with initial attempts returning only GID reference URLs instead of actual field values.

Working Solutions:

  • For metafields containing metaobject lists:
{% assign items = product.metafields.custom.namespace.value %}
{% for item in items %}
  {{ item.field_name.value }}
{% endfor %}
  • For shop-level metaobjects (all entries):
{% assign icons = shop.metaobjects.icon.values %}
{% for icon in icons %}
  {{ icon.title }}
{% endfor %}

Key Distinctions:

  • Use product.metafields.custom.key.value when metafield references specific metaobjects selected per product
  • Use shop.metaobjects.type.values to access all metaobject entries globally
  • Access nested fields with .field_name.value syntax

Rich Text Handling:
For rich text metaobject fields, use:

  • metafield_text filter (strips formatting)
  • metafield_tag filter (preserves hyperlinks, lists)

Status:
Resolved through community collaboration. Multiple users confirmed working implementations. Documentation gaps noted as a recurring frustration during the feature’s early rollout.

Summarized with AI on October 30. AI used: claude-sonnet-4-5-20250929.

You can use this package to convert that rich text AST to HTML.