I have created a text metafield list called ingredients and I want to loop through it in liquid.
The problem is when I do {{ product.metafields.info.ingredients }}, it gives me a result
[“Lorem Ipsum is simply dummy text of the printing.”,“Lorem Ipsum 2 is simply dummy text of the printing.”,“Lorem Ipsum 3 is simply dummy text of the printing.”,“Lorem Ipsum 4 is simply dummy text of the printing.”]
But when I try to loop through it like this
{% for ingredient in product.metafields.info.ingredients %}> - {{ ingredient }}
{% endfor %}
It doesn’t output anything. Any idea what I am doing wrong? Please help.
Solved it.
I was missing value in the for loop.
The correct syntax is
{% for ingredient in product.metafields.info.ingredients.value %}
{{ ingredient }}
{% endfor %}
19 Likes
YOU SAVED MY NIGHT!!! Thanks 
3 Likes
Thank you! Burnt up an hour trying everything to get the output.
Was missing the .value also
1 Like
This has totally helped, but now i have another wrinkle. I want each item in the metafield array (which are separated by commas) to link to a search of that item. But what I’m getting is a link to both items. I don’t think it is treating my metafield like an array. Is that something i needed to do when defining the metafield?
This is my code:
{% for movieactors in product.metafields.custom.movieactors.value %}
{{ movieactors }}
{% endfor %}
Thanks in advanced for any help you (or anyone else!) can provide.