Printed receipt code editor for your Shopify POS
You can customize your printed receipts using the code editor in your Shopify admin. The files that make up your receipts contain Liquid, Shopify's templating language. With the code editor, you can create more advanced customizations using HTML, CSS, and Liquid than with the visual editor.
You can change the receipt template and the section templates used on your printed receipts. The Receipts template files are the types of receipts that you can print in your store. Sections are parts of the receipts, such as the header or footer. Sections can be reused by multiple receipts.
On this page
- Considerations for using the receipt code editor
- Access the code editor
- Use custom files in your receipt template
- Reset your receipt template to default
- Liquid variables available in the receipt code editor
- Liquid filters available in the receipt code editor
- Example of a printed receipt template code customization
- Preview your code changes in the code editor
Considerations for using the receipt code editor
Before you use the receipt code editor, review the following considerations:
Access restrictions
- You can use the code editor only from your Shopify admin on desktop.
- The code editor isn't available for any POS locations in Italy.
Where changes apply
- Code changes that you make apply to the selected location only.
- Customizations in the code editor apply only to POS Pro locations. If you use the code editor and have non-POS-Pro locations, then you can use the visual editor to customize the header and footer for those locations.
- You can customize printed receipts that have a template in the code editor such as, sales receipts, gift receipts, gift card receipts, and returns and exchanges receipts.
Code languages
- The files that make up your receipts contain Liquid, Shopify's templating language. Learn more about using Liquid.
- To edit the templates in the receipt code editor, you need to be familiar with HTML, CSS, and Liquid. Shopify Theme Support can help with minor adjustments within the scope of the Shopify Design Policy.
Customization limitations
- You can't preview receipts in different printer sizes from the code editor. To preview by printer size, use the visual editor.
- Product descriptions aren't available as a variable in receipt templates and can't be added to printed receipts.
Template maintenance
- If you customize a receipt with the receipt code editor, then your existing template might be missing new properties, such as
selling_plan_name. To add the latest available properties to your template, you need to reset your receipt template to default. Resetting receipt templates to default removes any customizations you have made to them. Make a note of your customized code before you reset. After you reset the template, you need to manually reapply your customizations.
Access the code editor
You can edit your templates using the code editor. You must first switch to using the code editor from the default visual editor, and you can switch back to the visual editor at any time.
The steps for switching between the editors differ slightly depending on if all of your POS locations are eligible for the code editor, or if only some of your POS locations are eligible, for example, some of your POS locations don't use POS Pro or are based in Italy or France.
Steps:
All POS Pro locations
From your Shopify admin, go to Point of Sale > Settings.
In the Customization section, click Printed receipts to open the POS editor.
Click the
icon in the left sidebar.
Click Edit code.
In the Edit code for printed receipts dialog, edit the code you want to change.
Click Save.
Optional: To continue edit more Shopify POS pages using the POS editor, go back in your browser window.
With Lite or Italy locations
From your Shopify admin, go to Point of Sale > Settings.
In the Customization section, click Printed receipts to open the POS editor.
In the Receipt customization page, click Code editor.
Use custom files in your receipt template
You can use files, such as image assets, that you upload to your Shopify admin to customize your printed receipts.
A file must be uploaded to your Shopify admin before it can be used in a printed receipt. Learn more about file uploads.
Steps:
From your Shopify admin, go to Content > Files.
Beside the file that you want to include in your printed receipt code, click
to copy the link.
Include the asset link in your template.
Reset your receipt template to default
You can reset a receipt template to the default version using the code editor.
Steps:
All POS Pro locations
From your Shopify admin, go to Point of Sale > Settings.
In the Customization section, click Printed receipts to open the POS editor.
Click Customize your receipts.
Click Edit code.
Click the code file that you want to reset.
Click the
icon.
In the Reset the file to default dialog, click Reset.
With Lite or Italy locations
From your Shopify admin, go to Point of Sale > Settings.
In the Customization section, click Printed receipts to open the POS editor.
In the Receipt customization page, click Code editor.
Click the code file that you want to reset.
Click the
icon.
In the Reset the file to default dialog, click Reset.
Liquid variables available in the receipt code editor
You can use Liquid to customize your printed receipt template and receipt types.
The following data objects are available to the receipt code editor:
Receipt objects
| Object | Description |
|---|---|
shop | Contains the store information, such as the store name. |
location | Contains the retail location information, such as address and phone number. |
order | Contains the order data, including the line items, the discounts, the taxes, and the transaction information. |
return |
Only available within the template return-and-exchange-receipt.liquid and its associated partial templates.
Contains return and exchange data, including the returned line items, the new line items, the net total, and the transaction information.
|
gift_card |
Only available within the template gift-card.liquid.
Contains the gift card data, including the balance, the alphanumeric code, and the content of a QR code that can be scanned by the POS app.
|
Order object
| Property | Description |
|---|---|
id | ID of the order. |
created_at | The ISO 8601 formatted date and time when the order was created. |
source_identifier | A unique POS or third party order identifier. |
change_due | Change due on the order. |
balance_due | Amount owed on this order. |
name | The unique identifier for the order that appears on the order page in the Shopify admin and the Order status page. For example, "#1001", "EN1001", or "1001-A". This value isn't unique across multiple stores. |
note | The contents of the note associated with the order. |
line_items | A list of the order's line items. |
subtotal_price |
The sum of the prices for all line items after discounts and before returns. If taxesIncluded is true, then the subtotal also includes tax.
|
total_price | The total price of the order, before returns. This includes taxes and discounts. |
total_tip_received | The sum of all tip amounts for the order. |
discounts | The total amount of discounts. |
transactions | A list of transactions associated with the order. |
taxes_included | Whether taxes are included in the subtotal price of the order. |
tax_lines | A list of all tax lines applied to line items on the order, before returns. Tax line prices represent the total price for all tax lines with the same rate and title. |
customer | The customer that placed the order. |
shipping_address | The shipping address on the order. |
shipping_groups | The list of shipping group of the order. Each group contains line items that are fulfilled together. |
Return object
| Property | Description |
|---|---|
name | The unique identifier for the return that appears on the order page in the Shopify admin and the Order status page. For example, "#1000-R1". This value isn't unique across multiple stores. |
created_at | The ISO 8601 formatted date and time when the return was created. |
is_unverified | A boolean indicating whether the return was created as an Unverified Return. |
is_exchange | A boolean indicating whether the return includes an exchange. This includes refunds made to a gift card. |
exchange_type |
The type of the exchange, if the return includes an exchange. Possible values are LIKE_FOR_LIKE, NET_REFUNDABLE, and NET_PAYABLE.
|
return_discount | The total amount of order discounts that have been refunded. |
return_subtotal |
The sum of the prices for all return line items before discounts. If taxesIncluded is true, then the subtotal also includes tax.
|
return_total | The total possible refund amount. This includes taxes, discounts, shipping, and tips. It might not be the actual refunded amount. |
exchange_subtotal |
The sum of the prices for all new line items in the exchange before discounts. If taxesIncluded is true, then the subtotal also includes tax.
|
exchange_total | The total amount for all new line items in the exchange. This includes taxes and discounts. |
total_cash_rounding_adjustment | The cash rounding adjustment applied to the return or exchange. |
total_adjusted_amount | The total amount for the return or exchange adjusted by the cash rounding adjustment. |
net_total | The actual total amount paid or refunded for the return or exchange and before cash rounding. |
return_line_items | The returned line items. |
exchange_line_items | The new line items in the exchange. |
return_tax_lines | The tax lines for the returned line items. |
exchange_tax_lines | The tax lines for the new line items in the exchange. |
shipping_refund_amount | The amount of shipping that has been refunded. |
tip_refund_amount | The amount of tip that has been refunded. |
transactions | The transactions associated with the return or exchange. |
Shipping group object
| Property | Description |
|---|---|
destination | Destination of the products being shipped. |
products | A list of products being shipped. |
Line item object
| Property | Description |
|---|---|
id | The ID of the line item. |
name | The title of the product, optionally appended with the title of the variant (if applicable). |
variant_title | The title of the variant at time of order creation. |
price | The unit price of the line item when the order was created. This value doesn't include discounts. |
is_gift_card | Whether the line item represents the purchase of a gift card. |
discount | The total discount that have been allocated to the line item by discount applications, including discounts allocated to refunded and removed quantities. |
total_price | The total for this line item. |
selling_plan_name | The name of the subscription plan assigned to the line item. |
tax_rates | The tax lines for this line item. |
custom_attributes | A list of attributes that represent custom features or special requests. |
variant_title | The variant title. |
variant_id | The ID of the variant. |
variant_metafields | A list of custom fields that a merchant associated with the variant. |
staff_member_description | Staff member attributed to the line item. |
product_metafields | A list of custom fields that a merchant associated with the product. |
Return line item object
Includes everything in line item object plus the following properties:
| Property | Description |
|---|---|
return_reason | The return reason for the line item. |
return_reason_note | An optional note to go with the return reason. |
Liquid filters available in the receipt code editor
You can use Liquid filters to makes adjustments to information in your receipt templates. For example, you can change the formatting of currency or the captialization of specific text, such as a tax code.
To apply a filter, add a pipe character | and then the filter within the block of Liquid code between double curly brackets {{ }}. Filters can be applied only to blocks of Liquid code.
In the following example, the filter adjusts the tax code from lowercase to uppercase.
{{ tax_line.title | upcase }}In the example code block, product is the object, title is its property, and upcase is the applied filter. The upcase filter changes the capitalization of the value of tax_line.title to uppercase. For example, if tax_line.title has a value of Hst, then the upcase filter changes the value to HST.
Refer to the Filters section from the Shopify Themes Liquid reference for details on how to use Liquid filters.
The following filters are available in the receipt code editor:
| Property | Description | |
|---|---|---|
t | Translates predefined labels into the language assigned to your location. | |
money | Formats the price in your location's currency. | |
escape |
Escapes special characters in HTML, such as <>, ', and &, and converts the characters into escape sequences.
| |
barcode | Generates a 1D barcode SVG. | |
qrcode | Generates a 2D barcode SVG. |
Example of a printed receipt template code customization
You can use Liquid to add conditional messaging. This functionality is similar to saving to a single location with the visual editor. For example, your business started with a single location, and you now have several new locations. You want to highlight your original store on your printed receipts.
You can add a custom message to the header.liquid template in the Sections folder of the code editor, and use Liquid to display the message only for your flagship location.
The following code checks for the name of the location, in this case your original location called "Home", and displays the message "Welcome to our original store, opened in 1972." if the location matches the name. Receipts printed from your other locations display the message "Welcome to our store." instead.
{% if location.name == 'Home' %}
Welcome to our original store, opened in 1972.
{% else %}
Welcome to our store.
{% end %}Preview your code changes in the code editor
You can preview the changes to your printed receipts in the POS code editor in the Shopify admin.
Depending on which Liquid file is selected, the preview window highlights the design or section of the receipt affected by the file. By default, the preview window displays the content for your most recent POS order. You can select a specific order to use as your receipt content in the preview window for all Liquid files except for the gift-card.liquid file, which displays only the different locations as selectable preview options.
Steps:
All POS Pro locations
From your Shopify admin, go to Point of Sale > Settings.
In the Customization section, click Printed receipts to open the POS editor.
Click Customize your receipts.
Click Edit code.
Click the code file that you want to preview. Your receipt displays in the rightmost editor window.
Optional: To select a specific order to use as your receipt content in the preview window, do the following actions:
- Click the
icon.
- Sales made from the Point of Sale channel from all locations display in the Choose order to preview dialog. Select an order from the list, or search for specific orders and locations using the search bar.
- Click Confirm.
- Click the
Optional: If you're previewing the
gift-card.liquidfile, then click theicon and select the location that you want to preview the template for.
With Lite or Italy locations
From your Shopify admin, go to Point of Sale > Settings.
In the Customization section, click Printed receipts to open the POS editor.
In the Receipt customization page, click Code editor.
Click the code file that you want to preview. Your receipt displays in the rightmost editor window.
Optional: To select a specific order to use as your receipt content in the preview window, do the following actions:
- Click the
icon.
- Sales made from the Point of Sale channel from all locations display in the Choose order to preview dialog. Select an order from the list, or search for specific orders and locations using the search bar.
- Click Confirm.
- Click the
Optional: If you're previewing the
gift-card.liquidfile, then click theicon and select the location that you want to preview the template for.