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.

For any one else struggling with this, I found the solution from another comment below:

{% assign licenses = product.metafields.custom.product_features.value %}
{% for license in licenses %}

{% if license.one.value == true %} Hello One {% endif %}
{% endfor %}

UPDATE: custom.product_features with your Namespace and key
UPDATE: the word ‘one’ in license.one.value with your metaobjects field name

This should be the accepted solution; thanks!

@jacopol @haddi @LloydSpencer As per the shopify update we can only access the public metafiled if some app has own meta filed that can’t access to the theme file directly but may be different way you can access.

let me know I found this was correct to not?

I have same issue…

I’m afraid I don’t understand your question.

It’s worded for me, thanks a lot.

Hi @LazaEAG
So there is no way to display values from shop.metaobjects per product and not all the values from the website content?
We have to create a product metafield that contains a list of metabobjects instead of having a product metafield per metaobject right?

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

Quite late to reply here but for anyone coming to this post now, the best way to convert rich text values from metaobjects and/or metafields is to simply use the metafield_text filter, like so:

{%- assign rich_text_val = shop.metaobjects.some_metaobject.some_rich_text_input | metafield_text -%}

{{ rich_text_val }}
2 Likes

I should also mention that using the metafield_text filter will wipe out any formatting you might actually want to maintain in the rich text value. The other option would be to use the metafield_tag filter which keeps formatting like hyperlinks and lists.

1 Like

Thank you for metafield_text and metafield_tag filters, works for me.