Hi,
I want to display all products from my shop with best-selling products first on my home page. I know I can create a collection with all my product and sort them by best selling, but I don’t want to use this method because is not SEO friendly for my website. So I intend to use sort: / sort_by in my code to display the best selling product, but I didn’t manage to get them…
For now, this is part of my code :
{%- assign collection = collections.all -%}
this code gets all my product from my website. After that I try to display the product with :
{% for product in collection.products %}
It works perfectly, but I want to be sorted by best selling product, this is some example i try:
{% for product in collection.products | sort: 'best-selling' %}
{% for product in collection.products | sort_by: 'best-selling' %}
Any idea how to make this code work?