"Filter By Tags" Custom Dropdown showing no tags

Highlighted
New Member
10 0 0

Hello world,

 

I've recently implemented a dropdown "filter by tag" menu with this tutorial: https://shopify.dev/tutorials/customize-theme-filter-collections-with-product-tags

Worked great except for the fact that it's not showing any tags. It only shows "All" with no other option to select.

 

From a different shopify forum thread I tried to implement "assign_show tags" and writing them all down. Didn't change anything.

<section class="index-products"
  data-section-id="{{ section.id }}"
  data-section-type="featured-products"
  data-reviews="{{ showReviews }}"
  data-swatches="{{ enableSwatches }}">
  {% assign featured_products_heading = section.settings.title %}
  {% if featured_products_heading != blank %}
    <h2 class="theme coll-heading">{{ featured_products_heading }}</h2>
  {% endif %}
 
    <div class="clearfix filter">
  <p>Browse by tag:</p>
  <select class="coll-filter">
    <option value="">All</option>
    {% assign show_tags = "DRESSES,TOPS,BODYSUITS,JACKETS,PANTS,SKIRTS,SHORTS,SHOES,ACCESSORIES" | split: "," %}

{% for tag in collection.all_tags %}
  {% unless show_tags contains tag %}
     {% continue %}
  {% endunless %} {% if current_tags contains tag %}
    <option value="{{ tag | handle }}" selected>{{ tag }}</option>
    {% else %}
    <option value="{{ tag | handle }}">{{ tag }}</option>
    {% endif %} {% endfor %}
  </select>
</div>

<script>

Am I missing something?

Greetings

Timo

0 Likes