Shopify-Exit for loop-through if语句

Shopify-Exit for loop-through if语句,shopify,Shopify,我在一家shopify商店工作,但不是想卖产品,而是想预约。 我正在使用一个名为Sesami的shopify扩展来实现这一点 在customer/account.liquid页面中,我想向没有未来约会的人显示下一个(或多个)约会以及其他信息 我一直在尝试使用以下代码执行此操作: {% if customer.orders != blank %} {% for order in customer.orders %} {%- for line_item in order.line_items -

我在一家shopify商店工作,但不是想卖产品,而是想预约。 我正在使用一个名为Sesami的shopify扩展来实现这一点

在customer/account.liquid页面中,我想向没有未来约会的人显示下一个(或多个)约会以及其他信息

我一直在尝试使用以下代码执行此操作:

{% if customer.orders != blank %}
 {% for order in customer.orders %}
 {%- for line_item in order.line_items -%}
 {% for property in line_item.properties limit:1 %}
  {% assign today_date = 'now' | date: '%s' %}
  {% assign pre_date = property.last | date: '%s' %}
   {% if pre_date >= today_date %}
    {{ line_item.product.title | link_to: line_item.product.url }}
    {% for property in line_item.properties limit:1 %}
     {% if property != blank %}
      {{ property.last | date: format: 'abbreviated_date' }}
      {{ 'customer.orders.at' | t }} 
     {% endif %}
    {%- endfor -%}
    {% for property in line_item.properties offset:1 %}
     {{ property.last }}
    {%- endfor -%}
    {{ line_item.image |  img_url: 'small' | img_tag }}
    {{ order.fulfillment_status_label }}
   {% endif %}  
  {% endfor %}
  {%- endfor -%}
  {% endfor %} 
{% else %}
Content for people with no booking at all
{% endif %}
但问题是forloop保持打开状态,因此根据过去预约的总数,我希望向没有预约的人多次显示我希望显示的内容

我想有一个更简单的方法来做这件事,我希望你能帮我找到它

非常感谢,
Julien

如果希望循环停止当前迭代,请考虑使用
{%break%}


感谢本的帮助!我明白这是正确的做法,但我不知道如何正确地实施。它要么破坏了all INTERNATE(根本不显示任何内容),要么也破坏了if语句的第一部分(即使有更多的会议,也只显示1次即将召开的会议)。再次感谢!你能澄清一下你想打破哪些for循环吗?什么时候?如果没有任何预定,我想让它停止循环。因此,我要停止的循环是在我完成if语句之后,针对客户订单中的订单的循环。希望澄清可能您可以通过一个循环检查预订是否有即将到来的预订,将其保存为变量,然后根据该变量的结果执行显示循环。感谢Albert,这当然是最简单的方法。谢谢你帮我