Add
Adds two or more values together and merges the result. Use it to total up amounts you already have, such as a subtotal, tax, and shipping.
Syntax
{{add value1 value2 ... precision=n culture="xx-XX"}}
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| Values | Number | Required | Two or more values to add. These can be contact fields, transactional variables, or numbers you type directly. |
| precision | Number | Optional | Number of digits after the decimal point. When you set it, trailing zeros are kept, so precision=2 shows 3.50 rather than 3.5. When you leave it off, trailing zeros are trimmed. |
| culture | Text | Optional | The culture used to format the result. Defaults to your account's culture, so a French account already sees 3,50 rather than 3.50. |
Note: If a value is empty or is not a number, it counts as 0 and the rest of the calculation still runs. Your email will never fail to send because of this.
Examples
The examples below are based on the following sample content:
Order total: {{add Contact.subtotal Contact.tax Contact.shipping precision=2}}
A. Subtotal is 100, tax is 8.25, shipping is 5
Order total: 113.25
B. Shipping is empty
Order total: 108.25
C. Without a precision, using {{add Contact.subtotal Contact.tax}}
Order total: 108.25