I have this code and is not rendering anything.
{% assign array_of_awards = product.metafields.custom.single_product_awards.value.award_image %}
{% if array_of_awards %}
{% for award in array_of_awards %}
<img src="{{ award | image_url }}" />
{% endfor %}
{% endif %}
{{ array_of_awards }}
However, array_of_awards returns:
["gid://shopify/MediaImage/33224842510590","gid://shopify/MediaImage/33224844345598","gid://shopify/MediaImage/33224881996030","gid://shopify/MediaImage/33224879997182","gid://shopify/MediaImage/33224870396158","gid://shopify/MediaImage/33224876556542","gid://shopify/MediaImage/33224864694526","gid://shopify/MediaImage/33224850702590"]
@stressedowner
Hello,
Please try this below code (if you create a list metafield of images then works perfectly)
{% for award in product.metafields.custom.single_product_awards.value %}
{% if award!= blank %}
<img src="{{ award | image_url }}" />
{% endfor %}
{% endfor %}
Thankyou
This is not working. The loop is not returning anything.
{% for award in product.metafields.custom.single_product_awards.value %}
{% if award!= blank %}
<img src="{{ award | image_url }}" />
{% endif %}
{% endfor %}
1 Like
did you had solution for this? could you share for mw. i tried above way but not work 
Don’t know if you’re still looking for a solution, but I messed with @shreyhweb 's code and got mine working. My issue was I was using multiple image files for a gallery and this is how I’ve gotten it to work so far.
{% for [object] in shop.metaobjects.[object].[handle].[field].value %}
{% if [object]!= blank %}
{% endif %}
{% endfor %}
My actual code:
{% for custom_colors in shop.metaobjects.custom_colors.custom-finishes.gallery.value %}
{% if custom_colors!= blank %}
{% endif %}
{% endfor %}
How can I get this code and adapt it to my image gallery in my blog post?
I’ve tried this and it doesn’t work.
{% for image_object in article.metafields.custom.article_gallery %}
{% if image_object != blank %}
{% endif %}
{% endfor %}
Finally, the code that works for me is as follows:
{% for image in article.metafields.custom.image_gallery.value %}
{% if image!= blank %}
{% endif %}
{% endfor %}
1 Like
I was just about to reply with, "you probably just need to add “.value” to your string. Glad you figured it out and thanks for sharing.
1 Like