Create your own ecommerce website and start selling successfully with ShopWired today

Create your own ecommerce website and start selling successfully with ShopWired today

Splitting orders on the account page into multiple pages

Splitting orders on the account page into multiple pages

Before you proceed:
The following article contains information that requires you to have some prior knowledge about coding in order to correctly implement the proposed change to your theme. If done incorrectly alterations made to your theme’s code can negatively impact your website causing visual and performance issues. Therefore, we strongly recommend that you only undertake this effort if you are completely confident that you know what you’re doing. If you have no coding experience at all, aren’t entirely comfortable following the instructions in this article or if you simply don’t understand the instructions then we recommend you instead contact us, and our coding team will complete the work for you for a set fee.


When a customer logs into their account on your website they'll usually be shown a table displaying the orders they have placed.

By default, your theme will be set to show all the orders that a customer has placed. If your customers have placed a very large number of orders then you may want to add pagination onto this table to help load the page faster.

Instructions for adding pagination to this page are below:

1. You will need to add a setting orders_per_page to your theme's settings.json file. This is best placed in the 'other settings' section.

{
      "label": "Orders per page displayed on account home",
      "name": "orders_per_page",
      "type": "text",
      "defaultValue": 12
}

2. You'll then need to set the number of orders per page on the theme settings page.

3. You'll need to use the page editor to edit the account_home.twig file.

The following variables are available to implement pagination:

orders_per_page Returns the orders set per page

total_pages Returns the number of pages of orders

current_page Returns true if the page is the current page

order_count Returns the total number of orders

4. The following code will implement basic pagination...

{% if total_pages > 1 %}
      {% for page in 1..total_pages %}
            <a href="/account?page={{ page }}" class="{{ page == current_page ? 'current' : '' }}">{{ page }}</a>
      {% endfor %}
{% endif %}

If your theme is built using the Bootstrap Framework you can take advantage of the pre-styled links by using the following mark-up...

{% if total_pages > 1 %}
      <nav aria-label="Page navigation">
              <ul class="pagination">
                    {% if current_page > 1 %}
                          <li class="page-item">
                               <a class="page-link" href="/account?page={{ current_page - 1 }}">
                                     Previous
                               </a>
                          </li>
                    {% else %}
                          <li class="page-item disabled">
                                Previous
                          </li>
                    {% endif %}
                    {% for page in 1..total_pages %}
                           {% if page == current_page %}
                                 <li class="page-item active">
                                      <a class="page-link">{{ page }}</a>
                                 </li>
                           {% else %}
                                 <li class="page-item">
                                      <a class="page-link" href="/account?page={{ page }}">
                                             {{ page }}
                                      </a>
                                 </li>
                           {% endif %}
                    {% endfor %}
                    {% if current_page < total_pages %}
                          <li class="page-item">
                               <a class="page-link" href="/account?page={{ current_page + 1 }}">
                                      Next
                               </a>
                          </li>
                    {% else %}
                          <li class="page-item disabled">
                               Next
                          </li>
                    {% endif %}
            </ul>
        </nav>
{% endif %}

If your theme is built using the Foundation Framework...

{% if total_pages > 1 %}
      <div class="text-center">
             <ul class="pagination" role="navigation" aria-label="Pagination">
                    {% if current_page > 1 %}
                          <li class="pagination-previous">
                              <a href="/account?page={{ current_page - 1 }}">
                                    Previous
                              </a>
                          </li>
                    {% else %}
                           <li class="pagination-previous disabled">
                               Previous
                           </li>
                    {% endif %}
                    {% for page in 1..total_pages %}
                           {% if page == current_page %}
                                 <li class="current">
                                       {{ page }}
                                 </li>
                           {% else %}
                                 <li>
                                       <a href="/account?page={{ page }}">
                                              {{ page }}
                                       </a>
                                 </li>
                           {% endif %}
                    {% endfor %}
                    {% if current_page < total_pages %}
                          <li class="pagination-next">
                               <a href="/account?page={{ current_page + 1 }}">
                                     Next
                                </a>
                          </li>
                    {% else %}
                           <li class="pagination-next disabled">
                               Next
                           </li>
                    {% endif %}
            </ul>
       </div>
{% endif %}

Latest Articles

EU Accessibility Regulations Are Coming — Here’s What Nordic Merchants Need to KnowEcommerce

EU Accessibility Regulations Are Coming — Here’s What Nordic Merchants Need to Know

From 28 June 2025, new EU regulations will require all consumer-facing webshops to meet certain accessibility standards. Known as the European Accessibility Act (EAA), the goal is to make online stores...

Read more

Understanding the behavior of B2B buyers in 2024B2B Ecommerce

Understanding the behavior of B2B buyers in 2024

Navigating the complexities of B2B purchasing requires an in-depth understanding of buyer behavior, which has evolved significantly over recent years. Companies today must adapt to these changing dynamics...

Read more

Getting Started With Google ShoppingMarketing

Getting Started With Google Shopping

Google Shopping is a powerful platform that lets online stores showcase their products on both the Google results page and Google Shopping tab. This unique advertising opportunity helps brands put...

Read more

8 Ways to Improve Customer ServiceEcommerce business management

8 Ways to Improve Customer Service

The success of your ecommerce store depends on more than just top-notch products and savvy marketing. According to a study by Salesforce, 88% of customers said their whole experience with a business is...

Read more

Upgrading Magento: When Costs Outweigh BenefitsEcommerce business management

Upgrading Magento: When Costs Outweigh Benefits

When Magento was released back in 2007, the appeal of an open-source ecommerce platform quickly captured the attention of businesses wanting complete control over their online store. However, for...

Read more

AI in Ecommerce- Tips and ChallengesEcommerce business management

AI in Ecommerce- Tips and Challenges

Artificial intelligence (AI) is revolutionizing the ecommerce landscape.By 2030, the AI-enabled ecommerce market is estimated to reach $16.8 billion, growing by a rate of 15.7% CAGR in the next 8 years....

Read more

6 Signs You've outgrown your Ecommerce PlatformEcommerce

6 Signs You've outgrown your Ecommerce Platform

In the ever-evolving landscape of ecommerce, the success of your business hinges not only on the products you sell but also on the robustness of your ecommerce platform.As we navigate through an era where...

Read more

Website Migration SEO- How To Maintain SEO When Migrating Your WebsiteMarketing

Website Migration SEO- How To Maintain SEO When Migrating Your Website

When your current platform no longer meets your evolving needs, it might be time to consider a website migration. Such a transition, though often necessary, isn't just about shifting to a new platform;...

Read more

Start your 14 day free trial today

See why ShopWired is one of Europe's favourite ecommerce platform and start building your ecommerce website today.

No obligation, no credit card, no commitment, no contract