Why is my metaobject pagination not working?

My pagination suddenly doesn’t work on metaobject, an array of products.
It used to paginate correctly, where when I click on a page, the url parameter page_ca99c4e5=2, the render will render correctly.

{% paginate collection by numberOfProducts %}

{{- paginate | default_pagination }}
{% endpaginate %}

I have the same problem, has anyone managed to find a solution?

Same error on my theme also

For Pagination you can try below code to solve your issue,

{%- if paginate.pages > 1 -%}
{% render ‘pagination’, paginate: paginate, anchor: ‘’ %}
{%- endif -%}

add “pagination.liquid” file in your Snippets and add below code

{%- if paginate.parts.size > 0 -%}

    {%- if paginate.previous -%} {% assign original_string = paginate.previous.url %} {% assign specific_string = "page" %} {% assign specific_string2 = "=" %} {% assign content_after_specific_string = original_string | split: specific_string | last %} {% assign content_after_specific_string2 = original_string | split: specific_string2 | last %} {% assign new_url = original_string | replace: content_after_specific_string, specific_string2 | append: content_after_specific_string2 %}
  • {% render 'icon-caret' %}
  • {%- endif -%}

    {%- for part in paginate.parts -%}

  • {%- if part.is_link -%} {% assign original_string = part.url %} {% assign specific_string = "page" %} {% assign specific_string2 = "=" %} {% assign content_after_specific_string = original_string | split: specific_string | last %} {% assign content_after_specific_string2 = original_string | split: specific_string2 | last %} {% assign new_url = original_string | replace: content_after_specific_string, specific_string2 | append: content_after_specific_string2 %} {{- part.title -}} {%- else -%} {%- if part.title == paginate.current_page -%} {{- part.title -}} {%- else -%} {{ part.title }} {%- endif -%} {%- endif -%}
  • {%- endfor -%}

    {%- if paginate.next -%}
    {% assign original_string = paginate.next.url %}
    {% assign specific_string = “page” %}
    {% assign specific_string2 = “=” %}
    {% assign content_after_specific_string = original_string | split: specific_string | last %}
    {% assign content_after_specific_string2 = original_string | split: specific_string2 | last %}
    {% assign new_url = original_string | replace: content_after_specific_string, specific_string2 | append: content_after_specific_string2 %}

  • {%- render 'icon-caret' -%}
  • {%- endif -%}
{%- endif -%}

THANK YOU SO MUCH! This was exactly the solution I needed today. Bless you!

This is the solution to the MetaObject pagination with unique key added to the page query problem, I came up with:
The theme uses Tailwind and custom CSS.

{{ 'general.pagination.show' | t }} {{ paginate.current_offset | plus: 1 }}- {%- if paginate.next -%} {{-paginate.current_offset | plus: paginate.page_size -}} {%- else -%} {{- paginate.items -}} {%- endif %} {{'general.pagination.of' | t }} {{ paginate.items }} {{ itemsName }}.
    {% comment %} Previous Arrow {% endcomment %} {% if paginate.previous.is_link %} {% assign previous_page_number = paginate.previous.url | split: '=' | last %} {% assign previous_url = page.url | append: '?page=' | append: previous_page_number %}
  • {% render 'component__icon', icon: 'arrow-left', size: '20', class: '' %}
  • {% endif %}

    {% comment %} Numbers {% endcomment %}
    {% for part in paginate.parts %}
    {% if part.is_link %}

  • {{ part.title }} {% comment %} {{ part.title | link_to: part.url, class: 'btn btn--pagination' }} {% endcomment %}
  • {% else %} {% if part.title == '…' %}
  • {{ part.title }}
  • {% else %}
  • {{ part.title }}
  • {% endif %} {% endif %} {% endfor %}

    {% comment %} Next Arrow {% endcomment %}
    {% if paginate.next.is_link %}
    {% assign next_page_number = paginate.next.url | split: ‘=’ | last %}
    {% assign next_url = page.url | append: ‘?page=’ | append: next_page_number %}

  • {% render 'component__icon', icon: 'arrow-right', size: '20', class: '' %}
  • {% endif %}