When creating or updating a customer, you can add custom fields to the customer record, which you will be able to use this fields in the email templates.
Custom fields types
Custom fields should cannot be a nested object.
At the moment, Remarkety supports the following types:
- String
- Boolean
- Number
- Date-time (date-time field name should have a suffix of "_at")
Custom fields names
You can name your fields however you like, but we recommend to keep it clear and simple.
API Examples
The following example will add a boolean field (is_vip) and a date-time field (wedding_at):
curl --request PUT \
--url https://app.remarkety.com/api/v2/stores/{store_id}/customers/hash \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"customer": {"is_vip": true, "wedding_at": "2017-02-23T19:00:00+03:00"}}'
Using custom fields in tempaltes
Custom fields are available in email templates exactly like other customer fields.
You can use it like this: {$shopper.custom_field_name}
For example, to show the "wedding_at" custom field from the API Example, formatted, you can do:
{$shopper.wedding_at|dateformat:"m/d/Y"}
To conditionally check a custom field, you can use:
{if $shopper.is_vip}VIP Club{/if}