5
votes

I can't. I know.

Shopify imposes a limit when it comes to the number of products one can loop through on a page.

The current limit is 50.

Actually, this is not true.

One can loop through all the products of a store using liquid :

{% paginate collections["all-products"].products by 10000 %}

  {% for product in collections["all-products"].products %}

     {% comment %}looping through all 10000 products{% endcomment %}

  {% endfor %}

{% endpaginate %}

In the above example, if a store has up to 10000 products I can loop through all 10000 of them. Increasing that pagination number will increase the number of products I can loop through accordingly.

What I want to know is whether Shopify will continue to support this (even though they don't like it) and therefore, whether I can build stores using the above without the risk of the {% paginate collections["all-products"].products by 9999999 %} becoming deprecated at some point.

Having said that, I would obviously never loop through 10000 products, let alone 9999999 of them. But I definitely want to build stores where I will be looping through more that 500 products in one go for example.

1
pagination limit is maxed out at 1000. Beyond that it'll either stop at 1000 or give a liquid error. I have had the same issue earlier.HymnZzy
Great good to know HymnZ! So it means that this "hack" won't work either. You can make this the Answer to the question as this is what I was looking to confirm :-)Sprout Coder

1 Answers

4
votes

pagination limit is maxed out at 1000. Beyond that it'll either stop at 1000 or give a liquid error. I have had the same issue earlier.