Limit Product in a Collection to 20 (Liquid Code Question)

9 0 1

I've done some research though couldn’t find a simple explanation of what code snippet to use to limit the products in a collection.


I appreciate that a "forloop" code might do the trick, though I couldn't find any clear indication of where and how to implement it. 


Hope you can help!


This is my current collection code:



  "sections": {
    "product-grid": {
      "type": "main-collection-product-grid",
      "settings": {
        "products_per_page": 40,
        "image_ratio": "adapt",
        "show_secondary_image": false,
        "add_image_padding": false,
        "show_image_outline": false,
        "show_vendor": false,
        "show_rating": false,
        "enable_filtering": true,
        "enable_sorting": true,
        "collapse_on_larger_devices": false
  "order": [




Replies 4 (4)

Shopify Partner
51 7 7

Hello there,  try to change this value: "products_per_page": 40, try to change 40 to any other number to see is working or not.

If helpful then please Like and Accept Solution.
Feel free to contact me for your Website Tasks:
9 0 1

Thanks for the reply.


I think that would just limit the page size, though by scrolling down it would reveal the rest of the products.

Please correct me if I am wrong.

Shopify Partner
61 3 17

I am also looking on how to limit a collection to a certain number of items. I tried

{%- for product in collection.products limit:20 -%} but this also only limits the products to the page rather than to the entire collection. 
a little of this and a little of that
Shopify Partner
15 0 3

Did you find an answer to this?