How I can get most expensive products from collection in my liquid template? I have 8000-10000 products in collection. {{collection.products}} get only 50 items. {{pagination}} get only 1000 items. js fetch json get 250 items + it need filtering and sorting, so to get all products I need spend a lot of time. How can I get 3 most expensive products?
Hi @degorych ,
You can refer to the following code:
{% assign products_by_price = collection.products | sort: "price-descending" %}
{% for product in products_by_price limit: 3 %}
{% endfor %}
Hope it helps!
As I wrote abow, {{collection.products}} get only 50 items. I have 8000 - 10000 items in my collection. It is no working for big data. Loop fetch working, but it spend a lot of time.
Hi @degorych ,
This is a limitation of Shopify, you cannot change it. Therefore, Shopify only supports stores with products under 1000.
you can contact Shopify directly for more explanation, refer https://help.shopify.com/en/questions#/contact
Hope it helps!