Hi Shopifyers,
I’m new to Liquid code. I’m trying with the “Custom liquid” box on the product page, show an image that is in the media gallery if the product complies with a condition with their tags. If the product has a specific word tag have to show below description a specific image.
It’s not running !!!
Someone knows how can I do this?
Thanks,
This is the liquid code:
{% case product.tags %}
{% when ‘ICGC’ %}
return
{% when ‘IGN’ %}
return
{% else %}
Anything on screen
{% endcase %}
The issue is with your case statement. product.tags will return an array, so it won’t ever really equal just ICGC or IGN. A for loop will be more appropriate for this. You also don’t need to use return in liquid in the way that you have, liquid will output whatever is inside the case.
You’ll probably want do to something like

or
{% for tag in product.tags %}
{% if tag contains 'ICGC' %}

{% endif %}
{% if tag contains 'IGN' %}
{% endif %}
{% endfor %}
2 Likes
Many Thanks, @iDoThemes !!!
It’s running. In this way, I haven’t be insert an image for every product.
I inserted the second solution because I can adjust the dimension of every image
independently of others.
1 Like