All things Shopify and commerce
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?
Same here been doing this also but no luck, the sort filter doesn't support collection right now.
Best option is to create a collection that has been sorted to best-selling
then just display it in Liquid
{% assign best-selling= collections.best-selling-product-collection.products %}
{% for product in best-selling limit:3 %}
....
{% endfor%}
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024