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

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:

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.

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.

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

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

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

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!