Specify number of pages in pagination?

orangey
New Member
2 0 0

Hi,

I understand that one can change the number of products listed _per page_ via pagination. However, is there a way to specify the total number of pages?

My use case is as follows.

I want to create a 'New' collection that only shows products from the last 30 days. Creating this collection on the backend and ordering it by date is easy enough. On the Liquid side, I can compare the creation date to today's date and not show the product if it's older than 30 days. Unfortunately, the pagination does not take this filtering into account.

I was thinking to run a separate loop at the top (before pagination) to determine how many products in the collection fit within this threshold, and then specify that limit on the pagination call. But I cannot find any syntax for this in pagination. Is there a method to do this? Or am I just stuck having to omit pagination on this type of page? Or are there any other strategies you're all using?

Thank you

Replies 0 (0)