Re: Sort products in the collection by tags

How can I sort products in a collection using tags?

Ellen_Ele
Shopify Partner
8 0 1

Hi,
Is there any way to sort products in the collection by tags?
DO NOT filter by product tag, but sort products by whether they contain a particular tag.

Replies 7 (7)

saurav9005
Shopify Partner
99 15 25

Hi,
It discussed before here. please check this url 
https://community.shopify.com/c/shopify-discussions/sort-products-on-tag-pages-collection-page-produ...

please hit Like and Mark as Solution, If this answer solve your problem.  If you find my reply helpful, a small Coffee Tip would make my coding heart soar!
Ellen_Ele
Shopify Partner
8 0 1

Hi,

not exactly what I'm looking for.

 

it is suggested to order using the already filtered collection with the relative tag: /collections/{{ collection.handle }}/{{ tags_for_url }}?sort_by={{ option.value }}

 

I would like to be able to sort the entire collection and not the already filtered collection with the tag.

saurav9005
Shopify Partner
99 15 25

Can you explain - how sort going to sorted entire collection? Let's assume => you sorted by tag then what will happen in collection - only tagged items available or how it work?

I think you want filter not sort. 

please hit Like and Mark as Solution, If this answer solve your problem.  If you find my reply helpful, a small Coffee Tip would make my coding heart soar!
Ellen_Ele
Shopify Partner
8 0 1

Currently through Shopify you can order products using these ordering methods:

  • manual
  • price-ascending
  • price-descending
  • title-ascending
  • title-descending
  • created-ascending
  • created-descending
  • best-selling

 

What I would like to do is to be able to add another "custom" sorting that allows you to show products with a certain tag first.

 

 

saurav9005
Shopify Partner
99 15 25

I don't how it work with sort. Because it looks to me the filter => if you want to show only those tag products.

please hit Like and Mark as Solution, If this answer solve your problem.  If you find my reply helpful, a small Coffee Tip would make my coding heart soar!
LMiller
Shopify Partner
18 0 5

Hey there, were you ever able to figure this out? I've been digging through every .js and .liquid file trying to find where the default sort-options are even to just slightly adjust the logic that's existing. I don't mind creating a new one either but origin of that list begins with:

{%- for option in results.sort_options -%}

And I'm not even sure where to begin with even inserting said new sorting method (by tag) into the results.sort_options. 

Sulaman_Hassan
Shopify Partner
8 0 1

@Ellen_Ele  @LMiller @saurav9005 

I achive the way sort the product on collection page on tha base of tag 
let sat you adding the sorting number in every product  it will show normaly as usual in colleciton defulat sorting that provided in shopify admin but thorogh my code you will sort the product on tag based as well like
1 ,2,3,4,
and normal on collection page its show normal as thy come 
but on tag base accroing to sorting it will come accrdoing to your sorting

if you need my any help let me know 

Sulaman