Change Default Sorting on Main Product Catalogue

King_EJ
Visitor
2 0 0

Currently, the way the default product catalogue is sorted is by A-Z.
I want to change the default sorting to the newest products first. AKA "'created-descending'"

 

I've tried editing a bit of code on the "main-collection-product-grid.liquid", specifically:

 

// tried changing the default in this code to a few different options.

{%- assign sort_by = collection.sort_by | default: collection.default_sort_by -%}

 

// Added the below code as well.
{% if collection.handle == "all" %}
{% assign sort_by = 'created-descending' %}
{% endif %}

 

Please advise how to change the default sorting of the main product catalogue 

Replies 3 (3)

NomtechSolution
Astronaut
1245 113 145
  1. In the theme editor, navigate to the "Sections" folder and open the main-collection-product-grid.liquid file.

  2. Look for the following code:

 

{%- assign sort_by = collection.sort_by | default: collection.default_sort_by -%}

 

King_EJ
Visitor
2 0 0

Thanks for the reply Nomtech!

 

I have already messed with that code to no avail.

I'm sure it's the right line of code to change but I dont know what to change it to, in order to default it by product upload date.

 

I probably change this part, yea? "default: collection.default_sort_by"

 

To what?