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 %}