简体   繁体   English

仅当当前标签大于 1 时,如何在 Shopify 中显示当前标签过滤器

[英]How to show current tags filter in Shopify only if the current tags are more than 1

I need help please with showing the tags filter only if the current tags are more than 1 , Currently my filter shows even in the case on a single tag.我需要帮助,仅当当前标签超过 1时才显示标签过滤器,目前我的过滤器即使在单个标签的情况下也会显示。 I tried the following but couldn't find the exact liquid syntax:我尝试了以下但找不到确切的液体语法:

                  <dd>
                <ol>
                  {% for t in tags %}
                    {% assign tag = t | strip %}
                    {% assign tag_value = tag | handleize %} 

                    {% if current_tags contains tag %}
                    {% if current_tags > 1 %}
                      <li>
                        <input type="checkbox" value="{{ tag_value }}" checked/>
                        <label>{{ tag }}</label>
                      </li>
                    {% else %}
                      {% if collection.tags contains tag %} 
                        <li>
                          <input type="checkbox" value="{{ tag_value }}"/>
                          <label>{{ tag }}</label>
                        </li>
                        {% endif %}
                      {% endif %}
                    {% endif %}
                  {% endfor %}
                </ol>
              </dd>

Thanks in advance提前致谢

You can use this if condition to check current tags are more than 1如果条件检查当前标签大于 1,您可以使用它

{% if current_tags.size > 1 %}
{% endif %}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM