How to create Pagination in Shopify Liquids.

Pagination is a process that is used to divide large data into smaller discrete pages or we can say that Pagination is an ordered numbering of pages located at the top or bottom of a webpage. Pagination is a series of interconnected pages of related content. Pagination helps to split products, blog articles, and search results across multiple pages.

For adding pagination in your Shopify store, please follow these steps:

1 .Add this code where you want to create pagination.

{% paginate collection.products by 9 %}
   {% for product in collection.products %}
      // Your Code
   {% endfor %}

   {% if paginate.pages > 1 %}
      {% include 'pagination' %}
   {% endif %}
{% endpaginate %}

2. Create a snippet file pagination.liquid and paste the below code.expoundsofttechsolutionHow to create Pagination in Shopify Liquids.

<div class="pagination">  
  {% capture arrow_next %} 
  <span aria-label="{{ 'general.paginate.next_page' | t }}"> 
    {% include 'asset_svg' with 'arrow_icon_smaller' %}
  </span> 
  {% endcapture %}

  {% capture arrow_prev %} 
  <span aria-label="{{ 'general.paginate.previous_page' | t }}">
    {% include 'asset_svg' with 'arrow_icon_smaller' %}
  </span> 
  {% endcapture %}
  
  {{ paginate | default_pagination | replace: '&laquo; Previous', arrow_prev | replace: 'Next &raquo;', arrow_next }}
</div>

{% if paginate.next.is_link %}
   <a class="next-page hidden" href="{{ paginate.next.url }}">{{ paginate.next.title }}</a>
{% endif %}

3. Save your code and see changes.How to create Pagination in Shopify Liquids.