Variables are small lines code that you can place in your email templates, that work by automatically filling up with the subject line of that emails specific customer, order, and products on the order.
Variables are the key tool that allows you to speed up you email communication by automatically populating your emails with the correct information.
How it works
Variables are made of three parts.
Variables will only pull in the specific information you ask for. More often than not, it will just be a number. Therefore it is also important to add a description or a currency symbol in front of the variable to show the information properly.
The wrapper {{ }}
The object (this is the place within Booqable that the variable will look; such as cart, order, customer, company, employee, and document)
The key (this is the piece of information the variable will pull).
π‘Note: If you are looking to deal with negative numbers (like discounts) you will want to add a negative symbol (-) before the variable so that it looks like a negative amount.
1. How variables appear on emails
Below is an example manual email template called 'Let us know what you think!', asking customers after each order to include a review on the rental website.
It is populated with various email variables; including {{order.number}}, {{customer.name}}
and {{company.name}}
.
Here you can see that these variables are automatically changed into the order number, the name, and the company name of the individual customer connected to this order.
If you click the button for Preview at the bottom of this pop up box, you can also see what the customer will see when receiving the email in their inbox.
Below, you can browse through the variables below to add to your automatic, and manual templates to create the perfect emails for your customers.
π‘Note: Want to know if it is possible to send emails in different languages? Thankfully, it is! Write your email templates in the language of your choice, and include the same variables that you see below. They will populate using the data from the system in the same way, such as the order number.
2. Order variables
{{order.number}}
{{order.barcode.image}}
β{{order.status}}
β{{order.startsAt}}
β{{order.stopsAt}}
β{{order.deposit}}
β{{order.depositType}}
β{{order.depositValue}}
β{{order.discount}}
β{{order.discountPercentage}}
β{{order.price}}
β{{order.grandTotal}}
β{{order.totalTax}}
β{{order.grandTotalWithTax}}
β{{order.totalDiscount}}
β{{order.couponCode}}
{{order.couponDiscount}}
{{order.couponPercentage}}
{{order.startLocation.name}}
β{{order.startLocation.address}}
{{order.startLocation.addressLine1}}
{{order.startLocation.addressLine2}}
{{order.startLocation.city}}
{{order.startLocation.country}}
{{order.startLocation.zipcode}}
{{order.stopLocation.name}}
β{{order.stopLocation.address}}
{{order.stopLocation.addressLine1}}
{{order.stopLocation.addressLine2}}
{{order.stopLocation.city}}
{{order.stopLocation.country}}
{{order.stopLocation.zipcode}}
π‘Note: Currently the variable for {{order.startsAt}}
and {{order.stopsAt}}
cannot be altered. If you change your rental periods to exclude time selection for the customer, the time that will appear here are the default times you set up for each order.
3. Products and line items
To show information about the products on an order, you need to wrap the variables between {{#order.lines}}
and {{/order.lines}}
. This information is displayed for each product on an order.
Check the example below.
{{#order.lines}}
Β Β {{quantity}} x {{title}} | {{displayPrice}}
{{/order.lines}}
4. Document variables
{{document.name}}
β{{document.number}}
β{{document.date}}
β{{document.deposit}}
β{{document.depositHeld}}
β{{document.depositPaid}}
β{{document.depositRefunded}}
β{{document.depositToRefund}}
β{{document.paid}}
{{document.due_date}}
{{document.days_until_due}}
β{{document.prefix}}
β{{document.prefixWithNumber}}
β{{document.reference}}
β{{document.status}}
βΒ {{document.discount}}
β{{document.discountPercentage}}
β{{document.toBePaid}}
β{{document.price}}
β{{document.grandTotal}}
β{{document.grandTotalWithTax}}
β{{document.couponDiscount}}
β{{document.totalDiscount}}
5. Customer variables
This is how you can display information about your customers on your Booqable emails.
{{customer.name}}
β{{customer.mainAddress}}
β{{customer.avatarUrl}}
β{{customer.email}}
β{{customer.number}}
β{{customer.discountPercentage}}
β{{customer.depositType}}
β{{customer.depositValue}}
Β
6. Company variables
This is how you can display information about your company.
{{company.name}}
β{{company.address}}
β{{company.addressLine1}}
β{{company.addressLine2}}
Β
β{{company.city}}
β{{company.country}}
β{{company.email}}
β{{company.financialLine1}}
β{{company.financialLine2}}
β{{company.phone}}
β{{company.zipcode}}
Β
7. Employee variables
This is how you can display information about the Booqable user who's sending the email.
{{employee.name}}
β{{employee.firstName}}
β{{employee.lastName}}
β{{employee.avatarUrl}}
β{{employee.email}}
Β
8. Custom field variables
You can use variables in your email templates to quickly populate your emails with the custom fields you may have created for your online checkout, your products, your manual orders, and your customers.
Variables for custom fields have the following structure.
{{context.custom_fields.field_id}}
You'll need to replace the context
and the field_id
to target the correct custom field, like below.
To find the
field_id
, go to Settings > Custom fields and view the specific custom field you wish to include in your emails.
The context can be
order
,customer
, orproduct
.
9. Custom fields for customers, and orders
Putting it all together, a variable for a customer's address could look like below.
{{customer.custom_fields.contact_address}}
Check the example of a packing slip custom field below.
{{order.custom_fields.packing_notes}}
10. Custom fields for products
Like other email variables for products, custom fields for products are always added in an order line section.
This section renders product lines for all products on an order. It begins with {{#order.lines}}
and ends with {{/order.lines}}
.
Check the example below.
{{#order.lines}}
{{product.custom_fields.tubes_tires}}
{{/order.lines}}
You're all set!
You have now successfully learned how to automatically populate your emails with variables in Booqable.