Order Printer: what is the code...

Good morning,

I am wanting to add the number of orders a customer has placed with us to the order printer template, under their order number and the order date.

I can do the positioning and formatting. Please can somebody help with the code for the number of orders.

Thank you

Hey @TMM2 ,

You can absolutely display the number of orders a customer has placed using Shopify’s Order Printer app. The Order Printer template uses Liquid, and luckily, Shopify gives us access to some useful customer data within the order object.

To show the number of orders a customer has placed, you can use:

{% if customer %}
  Total Orders by Customer: {{ customer.orders_count }}
{% else %}
  Guest Checkout – No order history
{% endif %}

Where to put it:

Since you mentioned you want it under the order number and date, look for this section in your Order Printer template (or something similar):

Order #: {{ order.name }}  
Date: {{ order.created_at | date: "%B %d, %Y" }}

And insert your new line right after it:

Order #: {{ order.name }}  
Date: {{ order.created_at | date: "%B %d, %Y" }}  
{% if customer %}
  Total Orders by Customer: {{ customer.orders_count }}
{% else %}
  Guest Checkout – No order history
{% endif %}

Let me know if you want to customize the wording or only show it for returning customers.

Best,

Rajat

Shopify Expert

Hey @TMM2 Good Morning :sun: ,

Here is how you can add the number of orders a customer has placed in the Shopify order template.

{% if customer %}
  

Total Orders from this Customer: {{ customer.orders_count }}

{% endif %}

You can place this code under the Order Number and Order Template.

It will output you something like this.

Order #: #1005
Date: April 17, 2025
Total Orders from this Customer: 4

Let me know if you mode more help.

Thanks

Thank you. That was nice and easy. Really appreciate your help.

Thank you. All sorted. Really appreciate it.