How do I design my collection filters by product type? Not tags.

Highlighted
Tourist
8 1 0

Hello,
I currently using Debut Theme. I would like to make the collections could filterable by product types. However, it's allowing only filtering by tags.

 

{% for tag in collection.all_tags %}
                          {%- assign new_url = tag | link_to_tag: tag | split: 'href="' | last | split: '"' | first -%}
                          <option value="{{ new_url }}"{% if current_tags contains tag %} selected="selected"{% endif %}>{{ tag }}</option>
                        {% endfor %}
                      </select>
                      {% include 'icon-chevron-down' %}
                    </div>
                  </div>
                {% endunless %}
              {% endif %}

I know that I should change some parts of this code in the collection-template.liquid as product_type. But I couldn't find any way to do it.

 

Can anyone help me about this?

 

Best,

Ali

0 Likes
Highlighted
New Member
6 0 0

Did you find the answer to your problem?

having the same question

0 Likes
Highlighted
New Member
1 0 0

Same problem here. Any solutions?

0 Likes
Highlighted
Shopify Partner
2472 129 406

@AliCey @Alcercos @izzettavasi 

https://shopify.dev/docs/themes/liquid/reference/objects/collection#collection-current_type

https://shopify.dev/docs/themes/liquid/reference/objects/collection#collection-all_types

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes