Is there a “break” tag to escape a loop in Liquid?

For future visitors. Above code does work in current Liquid (gem v2.5.1).

So, you can simply do:

{% for item in cart.items %}
    {% if item.product.handle == "handle-name" %}
    variants = {{item.product.variants | json}};
       {% break %} // This will work
    {% endif %}
{% endfor %}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)