简体   繁体   中英

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. 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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