Hi, just got a simple question if
{% for category in product.categories %}
<div> {{ category.title }} </div>
{% endfor %}
shows all available category titles
How would I show only the first two category titles?
Do it like this:
{% for category in product.categories %} {% if loop.index < 3 %} <div> {{ category.title }} </div> {% endif %} {% endfor %}
1 comment
Do it like this: