(Cross post: Shopify Community)
I’m seeing some weird behavior on the /collections page.
This was tested on the Dawn theme (version 15.2.0). If I select anything other than ‘alphabetical’, the pagination fails, and all the collections are rendered at once.
Snippet from the Dawn theme code:
{%- liquid
case section.settings.sort
when 'products_high', 'products_low'
assign collections = collections | sort: 'all_products_count'
when 'date', 'date_reversed'
assign collections = collections | sort: 'published_at'
endcase
if section.settings.sort == 'products_high' or section.settings.sort == 'date_reversed' or section.settings.sort == 'alphabetical_reversed'
assign collections = collections | reverse
endif
assign moduloResult = 28 | modulo: section.settings.columns_desktop
assign paginate_by = 30
if moduloResult == 0
assign paginate_by = 28
endif
-%}
{%- paginate collections by paginate_by -%}
<ul
class="collection-list grid grid--{{ section.settings.columns_desktop }}-col-desktop grid--{{ section.settings.columns_mobile }}-col-tablet-down"
role="list"
>
{%- for collection in collections -%}
<li
class="collection-list__item grid__item{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--slide-in{% endif %}"
{% if settings.animations_reveal_on_scroll %}
data-cascade
style="--animation-order: {{ forloop.index }};"
{% endif %}
>
{% render 'card-collection',
card_collection: collection,
media_aspect_ratio: section.settings.image_ratio,
columns: 3
%}
</li>
{%- endfor -%}
</ul>
{% render 'pagination', paginate: paginate %}
{%- endpaginate -%}
As a side note, my store uses the Impulse theme (version 5.5.1). In this theme, the sorting logic is placed inside the paginate
tag, presumably as a workaround. The pagination does work in this case, but with a different unexpected behavior: it paginates the same way as alphabetical sorting, but then each page is individually sorted by date, product count, etc.
I can’t imagine this as something that can be fixed easily on the front end, but I’d appreciate any help.