Filter collection by product type

Highlighted
Shopify Partner
192 0 27

Hi all,

I was wondering if it is possible to filter a collection by product type, in the same way you may filter it by product tags?

I've been looking around the forum and all previous posts suggest you can only filter by product type at a top level, not at a collection level...
http://forums.shopify.com/categories/2/posts/41819
http://forums.shopify.com/categories/2/posts/32518#comment-34056

Just wondering if there has been any development on this since those posts?

I can see that you could create a similar effect by adding product type as a tag instead and possibly appending it with '[type] tag' in order to create a separate list of type tags but obviously types within collections would be more seamless.

Thanks for any help/pointers, even if it is a no!

Best, Keir

 

http://iamkeir.com
0 Likes
Shopify Partner
192 0 27

Discovered the answer is currently no, but hoping it might be something implemented in the future *crosses fingers*

http://iamkeir.com
0 Likes
Shopify Partner
2 0 1

I too hope they implement it too... It is does seem more seamless to be able to filter Collections by:

  • Product Type
  • Vendor
  • as well as Tags
0 Likes
New Member
1 0 1

Anyone who can point me to an alternative approach? My specific goal is to filter collection by product type. Thanks

1 Like
Shopify Partner
71 0 3

I think your best bet at the moment is to use product tags instead.

- Joel www.joeldrapper.com
0 Likes
Shopify Partner
1 0 0

found a way to do it. in collection.liquid

{% assign sorted_by_type = collection.products | sort: 'type' %}
	
{% for product_type in collection.all_types %}
	{% assign the_type = product_type %}
	{% for product in collection.products %}
		{% if product.type == the_type %}
			{{ product.title }}
		{% endif %}
	{% endfor %}
{% endfor %}

hope this helps…

0 Likes
Tourist
37 0 1

Hi Dan,

This doesn't work. Any way of creating an drop down option list to filter the products within that collection by 'type'?

0 Likes
Shopify Expert
351 0 34

you don't want to create a filter by type, correct? you want a sort?

0 Likes
Tourist
37 0 1

Yes please, anyway of doing this?

0 Likes
Shopify Expert
351 0 34

let's see what the community has to say -

but the 'sort' filter that Dan mentions above is a good start - the issue is this: liquid happens before the html is sent back to the viewer and then javascript happens locally... so, if you define 'sort by type' using liquid and want that to be triggered by some action the viewer does on the page there's a problem with the timing of that.

you could do a blend of these two solutions

http://docs.shopify.com/manual/configuration/store-customization/add-a-reorder-drop-down-menu-to-a-c...

http://ecommerce.shopify.com/c/ecommerce-design/t/sort-filter-sorting-by-vendor-and-type-161547

basically - set up smart collection handles that you an easily identify in logic when a page handle contains your 'trigger' string - and then have the collection page to render in different ways depending on those handle triggers.

0 Likes