Orders pagination is not working in account page liquid.

Excursionist
45 1 4

Customer has 6 orders.

 

{{ customer.orders.size }}

returns 6 every time.

 

When we try to paginate it using 

{% paginate customer.orders by 3 %}
{{ paginate.pages }}
Other Code. {% endpaginate %}

The {{ paginate.pages }} always returns 1 in case of multiple pages.
In our case it should return 2 not 1.

If we paginate it by 1 then it should return 6 in pages but it is returning 1.


If we paginate it by 6 then it prints all 6 orders perfectly. 

Any idea what is going on?

0 Likes
Shopify Expert
9811 92 1561

We're missing the surrounding code to know if there's a conflict. The HTML won't be as important to see, but any Liquid will be.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Excursionist
45 1 4

Thank you @Jason 

Here is the code for that.

 

<section class="section section--account account account--main">
    <div class="container container--tiny">
        <div class="section__title section__title--center section__title--desc">
            <h1 class="section__title-text h2">{{ 'customer.account.title' | t }}</h1>
            <p class="section__title-desc"><a href="/account/logout" class="link">{{ 'layout.customer.log_out' | t }}</a></p>
        </div>
    </div>

    <div class="container">
        <div class="o-layout">
            <div class="o-layout__item u-1/1 u-2/3@tab">

                <h2 class="h3">{{ 'customer.orders.title' | t }}</h2>
                <p class="disclaimer__subtext">Si vous avez des questions, obtenez une réponse immédiate en nous contactant via le Chat en bas cette page, ou nous contacter à <a href="mailto:{{ shop.email }}">{{ shop.email }}</a></p>

                {% paginate customer.orders by 1 %}
                    {% if customer.orders.size != 0 %}
                        <table class="responsive-table">
                            <thead>
                                <tr>
                                   	<th width="20px"></th>
                                    <th width="130px">{{ 'customer.orders.order_number' | t }}</th>
                                    <th width="150px">{{ 'customer.orders.date' | t }}</th>
                                    <th>{{ 'customer.orders.payment_status' | t }}</th>
                                    <th>{{ 'customer.orders.fulfillment_status' | t }}</th>
                                    <th width="150px">{{ 'customer.orders.total' | t }}</th>
                                    <th width="130px">Commander à nouveau</th>
                                  	<th width="180px">Facture</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for order in customer.orders %}
                                    <tr class="responsive-table__row">
                                      	<td style="text-align:left">{% if order.shipping_method.title == "Point de retrait" %} <img src="https://cdn.shopify.com/s/files/1/0062/1582/7569/files/drive-annecy-geneve--available.png?10606151800793069145" width="20"> {% else %} <img src="https://cdn.shopify.com/s/files/1/0062/1582/7569/files/livraison-locale-haute-savoie--available.png?10606151800793069145" width="20"> {% endif %}</td>
                                        <td data-label="{{ 'customer.orders.order_number' | t }}" style="text-align:left">
                                            <a href="{{ order.customer_url }}" class="link link--arrow">{{ order.name }}</a>
                                        </td>
                                        <td data-label="{{ 'customer.orders.date' | t }}" style="text-align:left">{{ order.created_at | date: format: 'short' }}</td>
                                        <td data-label="{{ 'customer.orders.payment_status' | t }}" style="text-align:left">{{ order.financial_status_label }}</td>
                                        <td data-label="{{ 'customer.orders.fulfillment_status' | t }}" style="text-align:left">{{ order.fulfillment_status_label }}</td>
                                        <td data-label="{{ 'customer.orders.total' | t }}" style="text-align:left">{{ order.total_price | money }}</td>
										<td data-label="Recommander" style="text-align:left">
                                          
                                          {% comment %} 
                                          	ces lignes de boucles for servent a construire un permalink, 
                                          	voir cette page : https://help.shopify.com/en/themes/customization/cart/use-permalinks-to-preload-cart#what-is-a-cart-permalink
                                          	et cette page : https://help.shopify.com/en/themes/customization/products/variants/find-variant-id
                                            {% assign urlpanier = "https://oops-livraison.fr/cart/" %}

                                              {% for line_item in order.line_items %}
                                                      <!-- qwert#{{ line_item.variant_id  }} et {{ line_item..quantity }} -->
                                                      {% assign urlpanierclic = urlpanier | append:line_item.variant_id | append:":" | append:line_item.quantity %}
                                              {% endfor %}

                                              <a href={{urlpanierclic}}>renouveler</a>
                                          {% endcomment %}
                                          
                                      	</td>
                                      	<td style="text-align:left">
  											<span class="invoice">
                                              <a target="_blank" href="{{ shop.url }}/apps/sufio/invoice/?id={{ order.id }}&number={{ order.order_number }}"><span style="font-size:12px">Télécharger facture PDF</span></a>
  											</span>
										</td>
									</tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    {% else %}
                        <p>{{ 'customer.orders.none' | t }}</p>
                    {% endif %}
                    {% if paginate.pages > 1 %}
                        <div class="account__pagination">
                            <div class="container">
                                <div class="pagination">
                                    <div class="pagination__items">
                                        {{ paginate | default_pagination: next: '<i class="icon icon--right-t"></i>', previous: '<i class="icon icon--left-t"></i>' }}
                                    </div>
                                </div>
                            </div>
                        </div>
                    {% endif %}
                {% endpaginate %}
            </div>
            <div class="o-layout__item u-1/1 u-1/3@tab">

                <h2 class="h3">{{ 'customer.account.details' | t }}</h2>

                {{ customer.default_address | format_address }}

                <p>
                    <a href="/account/addresses" class="c-btn c-btn--light">{{ 'customer.account.view_addresses' | t }} ({{ customer.addresses_count }})</a>
                </p>
				<p class="disclaimer__subtext">Vous disposez d'un droit d'accès et de modification de vos données personnelles en <a href="https://oops-livraison.fr/pages/demander-mes-donnees-personnelles">cliquant ici </a></p>
            </div>
        </div>
    </div>
</section>

This is Full code of template "customers/account.liquid"
The theme we are using is "Venue".

0 Likes
Tourist
4 0 0

 

I'm seeing the same thing, pagination for customer orders always returns 1 for paginate.pages?

0 Likes
New Member
1 0 0

Hi Jason

I have same issue on my site. Can you help me?

0 Likes