Display list off the unique product types?

Claes_Gustavsso
Shopify Partner
89 0 2

I´m trying to make a list off all the product types (I have created 3 different ones) that I have added when uploading products(I have added 15 products).
This is writing the product type for all the products I have uploaded(15 products), so it is writing the product types 15 times.

And I want to display only the unique 3 product types that I have added.

This is what I have now.
     {% for product in collections.all.products %}
      <li data-filter="{{ product.type }}">{{ product.type %}}</li> 
      {% endfor %}

I have search the forum, but I´m not finding the answers, so ant input appreciated, thanks.

0 Likes
Caroline_Schnap
Shopify Staff
Shopify Staff
5711 1 343

Hi Claes,

You can use shop.types to get your list, like so:

{% for product_type in shop.types %}
<li data-filter="{{ product_type }}">{{ product_type }}</li>
{% endfor %}

 

0 Likes
Caroline_Schnap
Shopify Staff
Shopify Staff
5711 1 343

The shop variable is documented here: http://docs.shopify.com/themes/liquid-variables/shop

0 Likes
Claes_Gustavsso
Shopify Partner
89 0 2

Hi Caroline and thanks a lot, works great!
I looked at the collection and product variables, never thought about "shop".
Thanks again.

0 Likes
Diego74
New Member
12 0 0

Hi, I have a problem, I have a widget that show the product type, but it showes product type that don't exist. Is there a file where I can delete manually the wrong tag?

Thanks

0 Likes