Limit number of items shown in one specific smart collection

Don_Campbell1
Tourist
10 0 2

I have created smart collection page sorted by date to show the latest additions to our galleries

It shows all products so I want to limit the number of products shown in that collection only.
https://boneart.co.nz/collections/whats-new

On another very old posting on the subject I have found this code snippet saying put it in the product loop but I have no idea where that is or where this bit should go

{% for product in collections.whats-new.products limit: 16 %}
  <!-- Your Markup Here -->
{% endfor %}

Any help would be greatly appreciated
Don

Replies 5 (5)
Don_Campbell1
Tourist
10 0 2

I have found a very basic workaround.

The reason I need to limit the number of products displayed on the recent additions page is that we have over 1000 products and the collection is still growing.
A smart collection sorted by date with the most recent at the top shows the latest updates but you end up with a collection that is 30+ pages long.

I realy only want the collection to be one page so was trying to figure out how to limit the new items displayed in the collection so it didn't go more than one page.

In the end I realized that rather than try to limit the number of products displayed to keep it to one page, perhaps it would be easier to just remove pagination for that collection only so it only displayed one page.
Without pagination the default number of items for a collections page in Shopify is 50 so a bit bigger than my standard collection page but it works as a single page collection and was easy to do.

You can see it at  https://boneart.co.nz/collections/whats-new
Note that the collection is actually 1000+ products but it only shows the most recent 50

How it was done:
I am new to shopify so still learning my way around liquid files etc so this will be very basic to most of you but for those new to all this, here are the steps. 

In the Theme editor I first added a new template based on a "collection" and called it collections.recent.liquid
Next I deleted the pagination lines (the first line and the last line) in the template.
(If any experts here find I have missed something please let me know)

In the admin panel under products/collections I then created a new smart collections page called "Whats New"
The conditions set were Price greater > $1 and inventory stock > 0 with "products must match all conditions" set
The the sorting was set to "By Date - Newest to Oldest.
In the Theme Template box I then selected the new collections.recent template and it was done.

Hope this helps

Jason
Shopify Expert
10440 169 2081

That's similar to what I would have done as well. Good approach.

Instead of deleting anything you could have also wrapped the section of code that shows the pagination buttons in a conditional statement. For example:

{% unless collection.handle == 'whats-new'%}
  ... your pagination buttons here
{% endunless %}

^ This will only show what's inside the statement if the collection handle does not equal "whats-new".

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.
Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.
★ http://freakdesign.com.au ★
Don_Campbell1
Tourist
10 0 2

Thanks Jason, I will give that a go.
Its all good learning.

Mark_Cunningha1
New Member
2 0 0

Thanks so much for this Jason, the conditional way to hide the pagination was a great tip.

:)

GreatPumpkin
New Member
2 0 0

Another quick way to do this is to use CSS to hide the pagination. Add this to the collection's description text (use the "Show HTML" view).

<style type="text/css"><!--
.pagination {
display: none;
}
--></style>