如何在 Liquid 中跳出循环,主要是 for 循环?我试过{% break %}
了,但是失败了There was errors Saving your file: Unknown tag 'break'。
我正在尝试实现以下目标:
var variants = [];
{% for item in cart.items %}
{% if item.product.handle == "handle-name" %}
variants = {{item.product.variants | json}};
{% break %} // won't work
{% endif %}
{% endfor %}