Limit # of products in frontpage collection -> Brooklyn

Chris_Hoare1
New Member
3 0 0

My frontpage collection is currently setup to contain my most popular products, and it's displaying in a separate ver of brooklyn I have running, but I cannot get the theme to only show the first 9 products in this collection - instead it's showing EVERY product (hence every product in my store) on in that collection. It appears the theme has the ability to control this but it isn't working. Here's the piece of script I'm assuming controls it but doesn't appear to when I change values found in featured-products.liquid


      {% if collections[settings.home_featured_products].products_count > 50 %}
        {% assign collection_product_count__product = 50 %}

I was hoping by dropping the values to 9 I'd be able to limit the products in the collage to 9 rather than all... but no dice.

0 Likes
Kushagra
Shopify Partner
39 0 7

Check this link

https://docs.shopify.com/themes/liquid-documentation/tags/iteration-tags#for

And find the section on 'limit'.

All you have to do is find the for loop that loops through all collection.products, might look something like

{% for product in collection.products %}

Just add 'limit:9' without quotes, before the closing tag. Check the link for reference. If you still have problems leme know.

Chris_Hoare1
New Member
3 0 0

That was driving me bonkers. Thank you kindly for the quick help! Have a great day.

 

0 Likes
Agnes_Leitner
New Member
5 0 0

All you have to do is find the for loop that loops through all collection.products, might look something like

 

Please - Where can I find this loop?

0 Likes
Peter_B_
Shopify Partner
17 0 3

For the file featured-products.liquid under Sections find a line:

{% for product in collections[section.settings.home_featured_products].products %}

and change it to:

{% for product in collections[section.settings.home_featured_products].products limit:9 %}

You will find 2 occurancies of the line in question - one for grid view, one for collage view.

 

- useful links in my profile / available for hire
Agnes_Leitner
New Member
5 0 0

Thanks Peter.

Simple and works just fine!

 

Best regards,

Agnes

________________________________

www.glueckskind-shop.com

Organic Premium Babyfashion Merino Wool & Silk - Designed in Salzburg

0 Likes
Sikindar_Mirza
New Member
1 0 0

Thanks, but I dont find that in my file

 

0 Likes