How can I customize the "Sort by" in an auto collection that displays tagged products?

How can I customize the "Sort by" in an auto collection that displays tagged products?

linia
Excursionist
22 1 20

Hi there,

 

I know how to change the 'Sort by' in collections that I create myself, however, I'm not sure how to customize the 'Sort by' when a collection is auto created to show tagged products.


See the screenshot below:

 

collection.png

 

When I click on product tags, the resulting collections always have 'Alphabetical' sort, which isn't great.

I'd love to change the default sort for these automatic collections to 'Best selling.'

I've tried creating and customizing an 'All' collection, but it messed up some of my settings, so I'd prefer to do this via code or another way.

Any help would be appreciated.

 

Replies 4 (4)

devmont-digital
Shopify Partner
132 31 34

hello @linia,

 

  • Go to the "Online Store" section.
  • Navigate to "Themes."
  • Select "Edit Code."
  • Search for the file named facets.liquid.
  • Locate the red-marked line of code and replace it with the new code.

Untitled-1.png

 

 

{%- assign sort_by = results.sort_by | default: 'best-selling' -%}

 

 

Found our answer helpful? If so, Don't forget to show your support by liking and accepting the solution.
Looking for more help and expert consultation? Feel free to contact us at Shopify Expert or visit our website www.devmontdigital.io
Hire us for your project by simply emailing us at sales@devmontdigital.io
linia
Excursionist
22 1 20

Hi there - thanks so much for the quick reply!  And for helping me learn where to look for this.

 

I've made this change - in fact, I saw the "results.default_sort_by" three times in the file and updated all three instances.


However, I'm still seeing the sort alphabetically.  Here's an example URL for the tagged collections:

https://linia-presentations.com/collections/all/timeline

 

I thought for sure this solution would work - any idea if there is another place I may need to look?

Boriana

linia
Excursionist
22 1 20

After a little more experimenting, what finally worked is that I did the same edit you suggested in the file ''main-collection-product-grid.liquid" and that did the trick.

 

I wanted to note it here in case others have the same issue getting things to work.

Thank you for sending me on the path to figuring it out!

INA_MSWEB
Shopify Partner
1266 143 163

Hello,

 

I am San from MS Web Designer.

 

Please share the URL and let me know which theme you are using so we can provide the proper solution to you.

 

Regards,

San

If it’s helpful to you, please mark it as a solution.  


Need Help with Shopify Design, Migration, Speed, or Custom tasks?  
email: hi@mswebdesigner.com
Try Our Conversion Booster app to get more sales | Connect Our Founder Linkedin