Hi guys, I’m facing a problem, please let me know if you’ve any solution for this. I’ve created a metaobject with the two values : one is list of files and second list of single line text, and attached it in a product metafield. now when I want to address those values in liquid as currently I’m easily able to address fields with single value but when it comes to multiple values(list of values) it’s creating a problem. It’s printing nothing when I’m addressing the multiple values field. {% assign prdata = product.metafields.custom.colourvariants.value %} {% assign prdataImg = product.metafields.custom.colourvariants.value.img %} {{ prdataImg }} {{ prdata.secimg }} here is the reference code, in the above code prdataImg contains list of files which is not printing anything and below you can see {{ prdata.secimg }} is a single value field and its visible {{ prdata }} is returning MetaObjectDrop I tried to take ChatGPT help, it also didn’t worked out.
Topic summary
Problem: Rendering multi-value metaobject fields in Shopify Liquid. A product metafield references a metaobject with two fields: a list of files (img) and a list of single-line text. Single-value access (e.g., prdata.secimg) works, but the list field (prdataImg from .img) outputs nothing. The value object returns MetaObjectDrop.
Code context: Assignments like {% assign prdata = product.metafields.custom.colourvariants.value %} and {% assign prdataImg = product.metafields.custom.colourvariants.value.img %}. {{ prdata.secimg }} renders via image_url, while {{ prdataImg }} doesn’t render.
Attempts: Suggested looping over prdata and printing {{ item.text }}; OP reports it didn’t work, noting .img is a list of images. A follow-up suggests piping the value to | json and looping; no confirmed success.
Status: Unresolved. Key need is the correct Liquid pattern to iterate and render list-type fields (e.g., list of files/images) inside a metaobject referenced by a product metafield. Code snippets are central to understanding the issue.
Hey @Kushagra0602
Please try this.
{% assign prdata = product.metafields.custom.colourvariants.value %}
{% for item in prdata %}
{{ item.text }}
{% endfor %}
Didn’t work, .img is a list of images and that’s where I’m stuck, it’s working prefectly with the single value. I tried to loop it also.
Sorry to know that it not worked,
{% assign prdata = product.metafields.custom.colourvariants.value | json %}
{% for item in prdata %}
{{ item.text }}
{% endfor %}
In this tried JSON