How do i change the order of the products on my the products page?

How do i change the order of the products on my the products page?

dhillongreene
Visitor
3 0 0

I am struggling to change the order of the products on my page. I want my newest items to show up first. I have tried to make this change when on the page, but it does not save. please help

Replies 3 (3)

round
Shopify Partner
113 18 10

@dhillongreene hi hope you are well,
Can you try with this code

 

{% assign sorted_products = collection.products | sort: 'created_at' | reverse %}
{% for product in sorted_products %}
  <!-- Your product display code here -->
{% endfor %}

 

 


I hope it works for you, let me know, and If you'd like to discuss this more, don't hesitate to send me a PM
Was my reply helpful? Click Like to let me know! Was your question answered? Mark it as an Accepted Solution.
dhillongreene
Visitor
3 0 0

Am I adding this to the CSS section of the specific module? (Sorry)

dhillongreene
Visitor
3 0 0

It did not work 😞