0
votes
{% for tag in product %}   
  {% if product.tags contains new %}
    <span>Test</span>
  {% endif %}
{% endfor %}

I need to look in products, and if a product has a tag called new then display a span tag if not then nothing.

For some reason, this piece of code doesn't work.

1

1 Answers

0
votes

This can do the job :

{% for product in products %}   
  {% if product.tags contains "new" %}
    <span>Test</span>
  {% endif %}
{% endfor %}