voucherPool Function
The voucherPool Helper Function allows you to add Voucher codes in Outgoing messages. Only Vouchers that are uploaded to your ActivatePro Platform can be used. For more information on Vouchers, please refer to the Vouchers section.
The syntax of this helper function is:
{{#voucherPool '{"name": [Voucher pool name]}'}}
{{[Voucher pool attribute]}}
{{/voucherPool}}
| Property | Type | Description |
|---|---|---|
| name | string | Required. The name of the of the voucher pool that is accessed. |
The voucher pool attributes that may be displayed within a message are the following:
| Attribute | Description |
|---|---|
| name | Optional. The name of the of the voucher pool that is accessed. |
| code | Required. The voucher code extracted from the voucher pool. |
| validFrom |
Optional. The date the voucher is valid from. e.g. 2018-07-14T00:00:00+0000To format this date, please use the date formatting function. |
| validTo |
Optional. The date the voucher is valid to e.g.2018-08-25T00:00:00+0000. To format this date, please use the date formatting function. |
| value |
Optional. The value or % amount of the voucher. e.g. 10.0. |
| type |
Optional. The type of voucher. The types can be eitherpercentage or the same value as the value attribute, depending on how your voucher pool was set up. |
| currency | Optional. The currency of the voucher pool. |
| minBasket | Optional. The minimum basket value that a user must have to be eligible for using a voucher. |
| conditions | Optional. The usage conditions for this voucher. |
| created | Optional. The date the voucher pool was created. |
| modified | Optional. The date the voucher pool was last modified. |
Use Case
Displaying a discount
For this example, we access the "Summer Sale Discount" voucher pool. This example voucher pool is valid from 01.07.2018 until 30.08.2018 and offers EUR 30.00 discounts to all shop visitors that make orders over EUR 200.00 in the category Summer Sale.
To display the voucher pool's validity dates in our preferred dd/mm/yyyy format, we will use the date formatting function.
{{#voucherPool '{"name": "Summer Sale Discount"}'}}
Use {{code}} to save {{value}} {{currency}} on your next order!
(valid {{computeDate '{"dateTrait": "validFrom", "outputFormat": "dd/MM/yyyy"}'}}
until {{computeDate '{"dateTrait": "validTo", "outputFormat": "dd/MM/yyyy"}'}})
*Only valid for purchases over {{minBasket}} {{currency}}.
Terms and conditions apply: {{conditions}}
{{/voucherPool}}
Once the function is evaluated, it displays the following text in the section where it is used in the message:
Use SD30Sdjat77 to save 30.0 EUR on your next order! (valid from 01/07/2018 until 30/08/2018) *Only valid for purchases over 200.0 EUR. Terms and conditions apply: - This voucher is only valid for purchases made in our Summer Sale category. - A voucher can only be used once. - The voucher is non-transferable. - This voucher must be redeemed on our website, applying it during the checkout process.