Liquid - Metafield of type list.metaobject_reference and iteration

Hello,

I have a meta field “estate” which is of type : list.metaobject_reference

When i do for example :

{% for myEstate in product.metafields.custom.estate.value %}
    {{ myEstate |  dump }}
{% endfor %}

I have only one entry in the for.

But when i do :

{{ product.metafields.custom.estate |  dump }}

I have the following print :

["gid://shopify/Metaobject/22999368029","gid://shopify/Metaobject/22999597405","gid://shopify/Metaobject/22999531869","gid://shopify/Metaobject/22999695709"]

I don’t understand why it doesn’t goes through all attached Estates, and if i do something like:

{{ product.metafields.custom.estate.value |  json }}

It show me the first referenced metaobject, but i cannot access any other one..

Any one has the same problem ? Is it a bug ? Base on documentation i should be able to iterate through all values.

But this is not working at this time.

Many thanks for any help :grinning_face_with_smiling_eyes:

2 Likes

Any news here?

Facing the same issue. Have you found a solution for this?

You can access the fields inside a metaobject in this way:

{% for metaobject in product.metafields.custom.metafield_key_name.value %}
  {% if metaobject.system.type == "metaobject_identifier" %}
    {{ metaobject.title }}
    {{ metaobject.content | metafield_tag }}
  {% endif %}
{% endfor %}