簡體   English   中英

是否可以在for循環Liquid Shopify中添加更多值?

[英]Is it possible to add more values in a for in loop Liquid Shopify?

這是我的代碼

{% for filter_prefix in filter_prefixes %}
{{ filter_prefix }}
{% endfor %}

我想將一些值添加到filter_prefixes ,例如:Type ...我可以這樣嗎?

{% for filter_prefix in filter_prefixes %}
{% filter_prefix = 'Type' %}
{{ filter_prefix }}
{% endfor %}

要列出所有filter_prefixes並添加“ Type值。

請幫我解決一下這個。

謝謝!

只需輸出所需的值即可。 無需將其添加到循環中,因為無論如何它只是您要輸出的內容。

Type
{% for filter_prefix in filter_prefixes %}
   {{ filter_prefix }}
{% endfor %}

或者使用Shopify陣列濾光器分割結合 因此,您將現有的數組filter_prefixes連接到一個字符串中,追加Type ,然后將其拆分回一個數組中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM