How can I extract values from a selected metaObject list?

Topic summary

Problem: Developers are struggling to extract values from Shopify metaobject lists in Liquid templates. Standard iteration methods return nothing or produce errors like “operation not allowed for this object.”

Root Cause: The metaobject list requires specific syntax to access its values—direct iteration or standard .value calls don’t work as expected.

Solution Found:

  • Use product.metafields.sp_custom.size_chart_metaobjects.value['size_chart_metaobjects'] to access the metaobject list
  • Apply a for-loop to iterate through specific values: {% for prod in product.metafields.sp_custom.size_chart_metaobjects.value['size_chart_metaobjects'] %}
  • The | json filter can help with debugging to visualize the data structure

Status: Multiple users confirmed the solution works after being stuck on this issue for extended periods. The problem appears resolved with the correct bracket notation syntax for accessing metaobject list values.

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

Hi everyone,

it looks so simple thing but can’t get the values of the metaobject when it is selected “List of values”.

I thought I have to once again iterate it. But it returns nothing. It is really frustrating debugging when not getting any errors.

{% assign myfields = product.metafields.sp_custom.size_chart_metaobjects.value %}

{{ myfields }}
// it return MetaobjectDrop

{% for m in myfields.sizes %}  
    {{m.value}} //nothing works
    {{m[0].value}} //nothing works
{% endfor %}

or

{% for m in myfields %}  
  {% for s in myfields.sizes %} 
    {{ s }} //nothing works
    {{ s.value }} //nothing works
    {{ s[0].value }} //nothing works
  {% endfor %}
{% endfor %}

this article doesn’t help much… https://community.shopify.com/c/technical-q-a/metaobject-values-in-metafields/m-p/1939164

Hi Darius,

Add this to your liquid and send here what you get in your browser console:


1 Like

I have the same issue. Really annoying. You get: “error: json not allowed for this object”
It’s an array. [“S”, “M”, “L”]

@josu24 what about the result of this one?


@josu24 what about the result of this one?


I am having this same issue… can’t figure out how to access the list of values correctly. ANy progress?

Give more information on what are you trying to access in your code send that part of your code here!

I did debugging metaobject when it is selected “List of values” below.

It should shows key and value set for size_chart_metaobjects metafield.

product.metafields.sp_custom.size_chart_metaobjects.value | json

So, product’s meta fields value can be referred by this code.

product.metafields.sp_custom.size_chart_metaobjects.value['size_chart_metaobjects']

Hope it works for everyone who has been stuck on this issue.

4 Likes

And also, a quick addition;

If you’d like to access a spesific type in this:

product.metafields.sp_custom.size_chart_metaobjects.value['size_chart_metaobjects']

you need to use a forloop to access it’s spesific values like the following:

{% for prod in product.metafields.sp_custom.size_chart_metaobjects.value
%}
{{ prod.title }}
{% endfor %}​
2 Likes

Amazing! Thank you so much!!! Been stuck on this problem for such a long time!

1 Like

Thanks a lot, that’s also helped me, even the Shopify chatbot also gave the error code, it took my full night.