I want to get the product sort collection product best-selling, price-descending and price_ascending usign custom code.
{% assign productsnow = collection.products | sort: "best-selling" %}
{% for product in productsnow limit: 4 %}
{{product .title}}
{% endfor %}
{% assign expensiveproduct = collection.products | sort: 'price-descending' %}
{% for product in expensiveproduct limit: 4 %}
{{product .title}}
{% endfor %}
{% assign productascending = collection.products | sort: "price-ascending" %}
{% for product in productascending limit: 4 %}
{{product .title}}
{% endfor %}
Could you please let me know the issue how to fix this.