In this article:
For Quotes or Order Confirmation
For Sales Orders
For Purchase Orders
For Invoices
For Product Line Items
For Extra Line Items
For Fulfillments
For Variant
For Company
For Contact
For Shipping and Billing Address
There are seven templates on your main app. These are;
- Quote
- Order Confirmation (used in the B2B e-Commerce portal)
- Sales Order
- Purchase Order
- Invoice
- Fulfilment
- Order Notification
To create your email templates, click on the settings tab on your app manager. Click on Email Templates.
Click on the ‘New Email Template’ button on the top right-hand corner of the page.
A popup such as the one below should appear;
You must fill in the name of the template and select the type of email you intend to issue from the dropdown box.
For the purposes of this example let's use the Sales Order template to go through the various features you can choose to include in your email.
On the right side of the page, you will see a row listing various types of information that you might need to include. These are;
- Issued At
- Order Number
- Payment Status
- Reference Number
- Ship At
- Total
- Document Link
Each of the listed properties above contains attributes that you can use in your template. To understand how this works, let's walk through the default Sales Order email template example.
At the end of the process to create your Sales Order receipt email it should read something like this:
This is a receipt for Sales Order XYZ, issued at dd/mm/yy. The payment status is currently finalized. Please pay SGD$*** and include this reference number 1234 in any of your deposits for our records.
The italicized content is information you will need to insert into the template by inserting the information into placeholders that are wrapped in “{{ }}”.
Familiarising yourself with these placeholders may seem daunting at first, however you should soon begin to see a recurring pattern and the process of using these placeholders soon becomes second-nature.
Let’s take a look at some of the more commonly used placeholders for a sales order template.
Objects
{{ order_number }}
Objects contain attributes related to the property being used. In this case, the attribute "order_number" is being called upon from the Sales Order property. Since the attribute is wrapped in "{{" and "}}", it would be interpreted and displayed in the email.
Tags
{% for item in product_line_items %}
Tags make up the programming logic that tells the template what to do. Anything within "{%" and "%}" would be processed but not displayed.
In this example, this tag will generate a “context”, within this context, you are able to directly access the “item”. An item is one element in a set of product_line_items.
This would allow you to do the following:
{{item.variant.name}} - {{item.quantity}}x for {{item.price}} each.
And have it generate each order line item in an order.
Control Flow Tag
{% if notes %}
Notes: {{ notes }}
{% endif %}
Control flow tag is used to determine which block of code should run based on a condition set. In the example, the notes would be shown in the email only if it exists. Otherwise, it would be ignored.
This is useful if you only want to render some static text (in this case “Notes: “) alongside a placeholder when the placeholder is available. Without this, if the order has no notes, a “Notes: “ line will be in the template with no text displayed after the colon.
Iteration Tag
{% for item in product_line_items %}
{{item.quantity}}x {{item.variant.title}}
{% endfor %}
An iteration tag is used to run a block of code repeatedly. The above example would go through each line item in the sales order and display the quantity and name of the item.
The templating system is a slight variant to Liquid, a publicly available library.
If you are curious to learn more about Liquid (and the other tags it has available), you can refer to the guide here.
Below is a list of attribute placeholders that you can add to the various templates and what they translate into in the actual email.
For Quotes or Order Confirmation
Attribute |
Description |
|
Company email |
issued_at |
Quote issue date |
notes |
Quote notes |
order_number |
The quote number |
reference_number |
The quote reference number |
ship_at |
Date where an order is shipped out |
total |
The total amount |
For Sales Orders
Attribute |
Description |
|
Company email |
issued_at |
Sales Order issue date |
notes |
Sales Order notes |
order_number |
Sales Order number |
reference_number |
Sales Order reference number |
ship_at |
Date where an order is shipped out |
total |
The total amount |
payment_status |
The payment status of the order |
Example
{{contact.first_name}} will render the first name of the contact assigned to an order.
Sales Orders and Quotes can also be assigned to a shipping or billing address. We provide some information on these addresses for the template.
Example
{{billing_address.address1}} will render the Address Line 1 of the address assigned to an order.
Sales Orders and Quotes can also be assigned to a company.
Example
{{company.name}} will render the name of the company assigned to an order.
There are two types of line items, those that belong to variants (product_line_items) and Extra Line Items for other costs (such as shipping or an order wide discount).
1) Product Line Items (product_line_items)
Attribute |
Description |
price |
Line item price |
line_subtotal |
Line item subtotal |
quantity |
Line item quantity |
discount |
Line item discount |
tax_rate |
Line item tax rate |
Product Line Items can also access everything available to the variant.
Example
{% for item in product_line_items %}
{{ item.quantity }}
{{ item.price }}
{{ item.variant.sku }}
{% endfor %}
2) For Extra Line Item (extra_line_items)
Attribute |
Description |
price |
Freeform line item price |
quantity |
Freeform line item quantity |
discount |
Freeform line item discount |
tax_rate |
Freeform line item tax rate |
label |
Freeform line item name |
Example
{% for item in extra_line_items %}
{{ item.quantity }}
{{ item.price }}
{{ item.label }}
{% endfor %}
For Purchase Orders
Attribute |
Description |
due_at |
Due date of the purchase order |
|
Company email |
notes |
Purchase Order notes |
order_number |
Purchase Order number |
reference_number |
Purchase Order reference number |
total |
The total amount |
Purchase Orders can be assigned to a company.
Example
{{company.name}} will render the name of the company assigned to an order.
They also have two types of line items, those that belong to variants (product_line_items) and custom ones for extra costs (such as shipping or an order wide discount).
1) Product Line Item (product_line_items)
Attribute |
Description |
price |
Line item price |
line_subtotal |
Line item subtotal |
quantity |
Line item |
tax_rate |
Line item tax rate |
Product Line Items can also access everything available to the variant.
Example
{% for item in product_line_items %}
{{ item.quantity }}
{{ item.price }}
{{ item.variant.sku }}
{% endfor %}
2) Extra Line Item (extra_line_items)
Attribute |
Description |
price |
Freeform line item price |
quantity |
Freeform line item |
tax_rate |
Freeform line item tax rate |
label |
Freeform line item name |
Purchase Order Line Items without a variant attached (i.e. an extra shipping line item or an order wide discount) are considered Extra Line Items.
Example
{% for item in extra_line_items %}
{{ item.quantity }}
{{ item.price }}
{{ item.label }}
{% endfor %}
For Invoices
Attribute |
Description |
invoice_number |
Invoice number |
due_at |
Due date of invoice |
invoiced_at |
Date of invoice |
notes |
Invoice notes |
total |
Invoice total |
1) Product Line Items
Attribute |
Description |
price |
Order line item price |
quantity |
Invoice line item quantity |
display_name |
Order line item variant title |
Products Line Items belong to Order Line Items that have a variant, so both Order Line Item and variant are available here.
Example
{% for item in product_line_items %}
{{ item.quantity }}
{{ item.order_line_item.quantity }}
{{ item.order_line_item.variant.sku }}
{% endfor %}
2) Extra Line Items
Attribute |
Description |
price |
Order line item price |
quantity |
Invoice line item quantity |
display_name |
Order line item label |
Extra line items belong to Order Line Items that have no variant, so Order Line Item is available here, but not variant.
Example
{% for item in extra_line_items %}
{{ item.quantity }}
{{ item.price }}
{{ item.label }}
{% endfor %}
Invoices can also be assigned to a billing address.
Example
{{billing_address.address1}} will render the Address Line 1 of the address assigned to an order.
For Fulfillments
Attribute |
Description |
notes |
Fulfillment notes |
packed_at |
Packing date |
shipped_at |
Date of fulfillment |
tracking_company |
Tracking company |
tracking_url |
Tracking URL |
tracking_number |
Tracking number |
Fulfillments belong to an order, so everything on an order is accessible here.
Example
{{ order.order_number }}
1) Product Line Item (product_line_items)
Attribute |
Description |
price |
Order line item price |
quantity |
Fulfillment line item quantity |
display_name |
Order line item variant title |
Products Line Items belong to Order Line Items that have a variant, so both Order Line Item and Variant are available here.
Example
{% for item in product_line_items %}
{{ item.quantity }}
{{ item.price }}
{{ item.order_line_item.quantity }}
{{ item.order_line_item.variant.sku }}
{% endfor %}
2) Extra Line Item (extra_line_items)
Attribute |
Description |
price |
Order line item price |
quantity |
Line item quantity |
display_name |
Order line item label |
Extra line items belong to Order Line Items that have no variant, so Order Line Item is available here, but not variant. This is normally used for order wide discounts or a shipping cost.
Example
{% for item in extra_line_items %}
{{ item.display_name }}
{{ item.price }}
{{ item.order_line_item.label }}
{% endfor %}
Fulfillments can also be assigned to a shipping address.
Example
{{shipping_address.address1}} will render the Address Line 1 of the billing_address assigned to a shipment.
For Variant
Attribute |
Description |
title |
Variant title |
sku |
Variant SKU |
weight |
Variant weight |
description |
Variant description |
name |
Variant name |
opt1 |
Variant Option 1 |
opt2 |
Variant Option 2 |
opt3 |
Variant Option 3 |
supplier_code |
Supplier Code |
For Company
Attribute |
Description |
name |
Company name |
For Contact
Attribute |
Description |
first_name |
Contact First Name |
last_name |
Contact Last Name |
name |
Contact Full Name |
|
Contact Email |
mobile |
Contact Mobile |
For example, in your Invoice template if you leave it as:
Hi{% if contact.first_name %} {{contact.first_name}}{% endif %},
-the contact will not be generated.
Rather, it should read:
Hi{% if order.contact.first_name %} {{order.contact.first_name}}{% endif %},
The email will then include the name of your contact.
For Shipping and Billing Address
Attribute |
Description |
first_name |
First Name |
last_name |
Last Name |
company_name |
Company |
address1 |
Address Line 1 |
address2 |
Address Line 2 |
city |
City |
country |
Country |
|
|
phone_number |
Phone Number |
state |
State |
suburb |
Suburb |
zip_code |
Zip Code |