Skip to main content

How to use variables to populate your email templates

Learn how to easily automate how emails are populated through the use of template variables in Booqable.

Updated over 3 weeks ago

Variables are snippets of code you can add to your email templates. They automatically populate with details such as the order number, customer name, or product information.

Using variables helps you speed up your email communication by ensuring the correct information is filled in automatically.


How it works

Variables are made of three parts:

  • Wrapper: {{ }}

  • Object: the place within Booqable that the variable will look (such as cart, order, customer, company, employee, or document).

  • Key: the piece of information the variable will pull.

💡Tip: If you are working with negative numbers (like discounts), add a negative symbol - before the variable so it displays as a negative amount.

1. How variables appear on emails

Here’s an example of a manual email template asking customers for feedback after an order:

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.

💡Tip: You can write templates in any language. The variables will always populate correctly (e.g., order numbers, totals).

2. Order variables

You can use these variables to display order-level information in your email templates:

{{order.number}}

{{order.barcode.image}}

{{order.status}}

{{order.startsAt}}

{{order.stopsAt}}

{{order.startsAtDate}}

{{order.startsAtTime}}

{{order.stopsAtDate}}

{{order.stopsAtTime}}

{{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.fulfilment_type}}

{{order.delivery_carrier_name}}

{{order.delivery_rate_amount}}

{{order.delivery_rate_name}}

{{order.delivery_address}}

{{order.billing_address}}

Start and stop location details:

{{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}}

Date and Time display options

You can control the display of dates and times in more detail, regardless of your shop's "Show times" setting.

  • Full date and time:
    {{order.startsAt}}, {{order.stopsAt}}

  • Date only:
    {{order.startsAtDate}}, {{order.stopsAtDate}}

  • Time only:
    {{order.startsAtTime}}, {{order.stopsAtTime}}

This gives you full control over how rental period information appears in your email templates.

💡 Note: The {{order.startsAt}} and {{order.stopsAt}} variables are still affected by the “Show times in shop” setting. The new variables {{order.startsAtDate}}, {{order.startsAtTime}}, etc., always return only the specific date or time, allowing greater flexibility.

Conditional discount display

If you only want to display the discount when there actually is one, you can use the following example:

{{#order.hasDiscount}} | Discount | {{order.discountPercentage}} | {{/order.hasDiscount}}

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}}

{{document.fulfilment_type}}

{{document.delivery_rate}}

{{document.delivery_carrier_name}}

{{document.delivery_rate_amount}}

{{document.delivery_rate_name}}

{{document.delivery_address}}

{{document.billing_address}}

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, or product.

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}}
Did this answer your question?