Order Printer: what is the code...

Solved

Order Printer: what is the code...

TMM2
Tourist
8 0 2

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 

 

Accepted Solution (1)

rajweb
Shopify Partner
825 71 155

This is an accepted solution.

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

 

Rajat | Shopify Expert Developer
Need a reliable Shopify developer for your next project?
Our App: Productify Groups App
Email: rajat.shopify@gmail.com
Portfolio: https://rajatweb.dev

View solution in original post

Replies 4 (4)

rajweb
Shopify Partner
825 71 155

This is an accepted solution.

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

 

Rajat | Shopify Expert Developer
Need a reliable Shopify developer for your next project?
Our App: Productify Groups App
Email: rajat.shopify@gmail.com
Portfolio: https://rajatweb.dev
TMM2
Tourist
8 0 2

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

TheScriptFlow
Shopify Partner
722 52 97

Hey @TMM2 Good Morning ☀️,

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

{% if customer %}
  <p>Total Orders from this Customer: {{ customer.orders_count }}</p>
{% 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

 

- Need a Shopify Specialist? Chat on WhatsApp Or Email at info@thescriptflow.com

- Boost Your Sales with Affiliate Marketing - UpPromote: Affiliate & Referral


- If my solution was helpful, mark it as a solution and hit the like button! And Wait Don't forget to Buy me a Coffee

TMM2
Tourist
8 0 2

Thank you. All sorted. Really appreciate it.