Skip to content

Instantly share code, notes, and snippets.

@enamhasan
Created March 23, 2016 11:12
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save enamhasan/eb9606a078b635fb54d6 to your computer and use it in GitHub Desktop.
Save enamhasan/eb9606a078b635fb54d6 to your computer and use it in GitHub Desktop.
Shopify Order Printer Template with product image, variations and line item properties
<p style="float: right; text-align: right; margin: 0;">
{{ "now" | date: "%m/%d/%y" }}<br />
Invoice for {{ order_name }}
</p>
<div style="float: left; margin: 0 0 1.5em 0;" >
<strong style="font-size: 2em;">{{ shop_name }}</strong><br /><br />
{{ shop.address }}<br/>
{{ shop.city }} {{ shop.province_code }} {{ shop.zip | upcase }}<br/>
{{ shop.country }}
</div>
<hr />
<h3 style="margin: 0 0 1em 0;">Item Details</h3>
<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>Product Image</th>
<th>Quantity</th>
<th>Item</th>
<th>Device<th>
{% if show_line_item_taxes %}
<th>Taxes</th>
{% endif %}
<th>Price</th>
</tr>
</thead>
<tbody>
{% for line_item in line_items %}
<tr>
<td><img src="{{ line_item.product.featured_image | product_img_url: 'thumb' }}" /></td>
<td>{{ line_item.quantity }} </td>
<td>{{ line_item.quantity }} <b>{{ line_item.title }}</b></td>
{% comment %}
<td>
{% unless line_item.variant.title contains 'Default' %}
{{ line_item.variant.title }}
{% endunless %}
</td>
{% endcomment %}
<td>
{% assign property_size = line_item.properties | size %}
{% if property_size > 0 %}
{% for p in line_item.properties %}
{% unless p.last == blank %}
<b>{{ p.first }}:</b>
{% if p.last contains '/uploads/' %}
<a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
{% else %}
<b>{{ p.last }}</b>
{% endif %}
<br>
{% endunless %}
{% endfor %}
{% endif %}
<td/>
{% if line_item.tax_lines %}
<td>
{% for tax_line in line_item.tax_lines %}
{{ tax_line.price | money }} {{ tax_line.title }}<br/>
{% endfor %}
</td>
{% endif %}
<td>{{ line_item.price | money }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if transactions.size > 1 %}
<h3 style="margin: 0 0 1em 0;">Transaction Details</h3>
<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>Type</th>
<th>Amount</th>
<th>Kind</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for transaction in transactions %}
<tr>
<td>{{ transaction.gateway | payment_method }}</td>
<td>{{ transaction.amount | money }}</td>
<td>{{ transaction.kind }}</td>
<td>{{ transaction.status }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<h3 style="margin: 0 0 1em 0;">Payment Details</h3>
<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<tr>
<td>Subtotal price:</td>
<td>{{ subtotal_price | money }}</td>
</tr>
{% for discount in discounts %}
<tr>
<td>Includes discount "{{ discount.code }}"</td>
<td>{{ discount.savings | money }}</td>
</tr>
{% endfor %}
<tr>
<td>Total tax:</td>
<td>{{ tax_price | money }}</td>
</tr>
{% if shipping_address %}
<tr>
<td>Shipping:</td>
<td>{{ shipping_price | money }}</td>
</tr>
{% endif %}
<tr>
<td><strong>Total price:</strong></td>
<td><strong>{{ total_price | money }}</strong></td>
</tr>
{% if total_paid != total_price %}
<tr>
<td><strong>Total paid:</strong></td>
<td><strong>{{ total_paid | money }}</strong></td>
</tr>
<tr>
<td><strong>Outstanding Amount:</strong></td>
<td><strong>{{ total_price | minus: total_paid | money }}</strong></td>
</tr>
{% endif %}
</table>
{% if note %}
<h3 style="margin: 0 0 1em 0;">Note</h3>
<p>{{ note }}</p>
{% endif %}
{% if shipping_address %}
<h3 style="margin: 0 0 1em 0;">Shipping Details</h3>
<div style="margin: 0 0 1em 0; padding: 1em; border: 1px solid black;">
<strong>{{ shipping_address.name }}</strong><br/>
{% if shipping_address.company %}
{{ shipping_address.company }}<br/>
{% endif %}
{{ shipping_address.street }}<br/>
{{ shipping_address.city }}
{{ shipping_address.province_code }}
{{ shipping_address.zip | upcase }}<br/>
{{ shipping_address.country }}
</div>
{% endif %}
<p>If you have any questions, please send an email to <u>{{ shop.email }}</u></p>
@ahmedesoliman
Copy link

Is there is a way to include the product SKU no to the template? Thanks in advance1

@MrBayoumi
Copy link

MrBayoumi commented Oct 18, 2019

Almost a year later and i have put this to good use, thanks a lot!
I still have a question: What is this for?

 <td>
        {% assign property_size = line_item.properties | size %}
                    {% if property_size > 0 %}
                      {% for p in line_item.properties %}
                        {% unless p.last == blank %}
                          <b>{{ p.first }}:</b>

                          {% if p.last contains '/uploads/' %}
                            <a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
                          {% else %}
                            <b>{{ p.last }}</b>
                          {% endif %}

                          <br>
                        {% endunless %}
                      {% endfor %}
                    {% endif %}
        <td/>

@enamhasan
Copy link
Author

Hi,

Glad to know this helps to you. The part of code above is for line item properties / custom fields from shopify product page.
To know more about line item properties, you can read this article

https://help.shopify.com/en/themes/customization/products/features/get-customization-information-for-products

Thank you.
Enam

@IrakliZakaidze
Copy link

IrakliZakaidze commented Apr 2, 2020

@enamhasan My friend, I copied up your html template and saved it in Shopify's order printer. I'm satisfied with everything, except that it's in letter size. I have a small zebra label printer which is a length of 8inch and width of 4inch. If you can, please provide a template for this data.

@gabesqueda
Copy link

This is very useful, I only have one question, how can I delete the word "VAT" in the tax description, I live in Mexico so I only need the Tax and the amount but not the VAT word.
Captura de Pantalla 2020-08-22 a la(s) 8 15 43 a  m

@csanyipeti
Copy link

Hey there! Big question: is there a way to enlarge the product image in the template? Much appreciate your help :)

@briscolion
Copy link

is there a way to minus discount amount from to show actual outstanding amount after discount

@Himal32
Copy link

Himal32 commented Feb 5, 2021

Best and correct post.

@ebproject
Copy link

This is very useful, I only have one question, how can I delete the word "VAT" in the tax description, I live in Mexico so I only need the Tax and the amount but not the VAT word.
Captura de Pantalla 2020-08-22 a la(s) 8 15 43 a  m

Remove {{ tax_line.title }} from the code, that'll remove VAT

@ebproject
Copy link

ebproject commented May 12, 2021

Hey there! Big question: is there a way to enlarge the product image in the template? Much appreciate your help :)

Try adding width="100px" or whatever px size you desire in the img tag.

@bronzy29
Copy link

It was exactly what I was looking for. Thank you.

@radilafridi
Copy link

How can i add shipping address phone number to shipping details?

@gmagrobbelaar
Copy link

Try This

{{ shipping_address.name }}
{{ shipping_address.phone }}
{{ customer.email }}
{{ shipping_address.zip | upcase }} , {{ shipping_address.city }}
{{ shipping_address.street }}
{{ shipping_address.city }} {{ shipping_address.province_code }} {{ shipping_address.country }} {% if shipping_address.company %}
{{ shipping_address.company }}
{% endif %}

@gmagrobbelaar
Copy link

How would I change the image to the variant image? I have two colour variants and want that variant's image to be displayed.
I have a list in the line item variants. This is a list of names to engrave on one of the two colours. How can I have some sort of separation between customer inputs?

Thanks for the help
Screenshot 2022-12-01 at 09 12 08

@nandzks7
Copy link

nandzks7 commented Jan 7, 2023

image

removeed the first product from the admin side. then it is still there and this duplication occurring. how to fix this error?

@GiftsInaJiffy
Copy link

Rather than the store name on the top left, how can I change that to my logo?

@enamhasan
Copy link
Author

Thank you, Guys. I missed some of the above messages. If anyone still need help please let me know. You can also reach me at enamhasan@gmail.com

@jfrux
Copy link

jfrux commented Aug 17, 2023

We need to update for Order Edits / Refunds!
Anybody done any of this work?

@Wizkyyyy
Copy link

Wizkyyyy commented Dec 7, 2023

I got a question can I use order printer to print the recipe ?

@MOHTAKKO
Copy link

Hello - Very good design - thank you.
If I want to add SKU and Barcode (the digits only) ; can you please write the code script and where to put them?

@raytcw
Copy link

raytcw commented Jan 10, 2024

hi, happy i can find help here for the packing slip template. i'm looking for a template code that focus on the product images, which mean the product image will show in bigger size, as well as the qty value, this is for better viewing experience for my helper with lower sight ability. really hope someone can help here. thank you

@WorklifeWorkwear
Copy link

Hello, thank you very much for providing this HTML template. Is there a way to add RECEIPT numbers to 'Pay Later' reports, if so can you please provide the coding script to do so? Thank you again! I am trying to avoid using a third-party app, none so far have the ability to add receipt numbers to their invoices either.

@geongeorge
Copy link

Hello all, I assume most of you are developers. We built a shopify order printer app that can take any value from the order object using graphql. I know it is a bit complicated but we realized for many use cases for our clients the shopify order printer app was not enough.

Our app is called Pixi order printer We have also open sourced the starter with with we built it from.

@harsh-b-eq
Copy link

Hello all,

I want to print discount title or code but
{{ discount.title }} is not working at all....

is there any one who know how to show discount title in order printer app?

@cbodron
Copy link

cbodron commented Apr 11, 2024

Hi everybody, I need to customise my order printer template to print :

{{ shipping_address.name }}
{{ shipping_address | format_address }}

I need to have adress in center, full width (80mm) and full height (50 mm) of my label.

Can someone help me please ? I deseperate....

@ksawalme
Copy link

hi, thank you very much for provide this for all that will give your much deed from allah and god blass you
I realy appraciate you help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment