Pagination is not respecting the given size

Short description of issue

Pagination is not respecting the given item size

Link to Shopify Store

Reproduction steps

Something has changed in terms of paginating collections in app blocks. The given item size is not respected. App block code to reproduce:

{% assign collection = collections['products-without-packs'] %}

<h1>First pagination 3</h1>
{% paginate collection.products by 3 %}
  {% for collection_product in collection.products %}
    {{ collection_product.id }}
    <br>
  {% endfor %}
  <h2>{{ paginate.page_size }}</h2>
{% endpaginate %}

<h1>Second pagination 250</h1>
{% paginate collection.products by 250 %}
  {% for collection_product in collection.products %}
    {{ collection_product.id }}
    <br>
  {% endfor %}
  <h2>{{ paginate.page_size }}</h2>
{% endpaginate %}

{% schema %}
{
  "name": "Test",
  "templates": ["product"],
  "target": "section",
  "settings": []
}
{% endschema %}

I am attaching a screenshot of the resulting page. As seen on the screenshot, the pagination of size 250 doesn’t yield 250 items. Please also note that the first pagination did not render the first 3 products of the collection.

Additional info

The collection used for testing has 150 products.

Sometimes, after reloading the page later, the result is different and more items are rendered. It seems there is some kind of caching involved.

What type of topic is this

Bug report

Upload screenshot(s) of issue

Hello Anton,

I think this isn’t an issue with your Liquid code. The {% paginate %} tag only works reliably in collection template contexts. Inside app blocks, results can vary due to caching and backend query limits, which is why the page size isn’t respected.

I have some suggested Workarounds:
You can use pagination only in collection templates, or simulate it with offset/limit on collection.products, or fetch via the Storefront API.

In short, this is a platform limitation, not a coding error.

This was working perfectly fine until very recently. Our app relies on rendering paginated collections inside the app block to provide bundle functionality, so this change is affecting us directly.

Hi Anton, I think your code is fine, the issue comes from Shopify itself. paginate doesn’t work reliably inside app blocks due to caching and rendering limits. Best workaround is to move pagination to a section/template, or use the Storefront/Section Rendering API with JS for full control.

Can I have the preview password of your store?