You can use simple arithmetical operators for JSON data comparisons.
Let's say you want to offer an incentive (free shipping/voucher) to your customers if their total order exceeds 50 USDs.
External JSON event data is based on a fixed structural hierarchy: {{event.order.total}}
.
The below lines show you how to write conditions about the monetary value ofevent.order.total
.
{% if event.order.total = 50 %} Order total is exactly 50{% endif %}
{% if event.order.total != 50 %} Order total is not exactly 50{% endif %}
{% if event.order.total > 50 %} Order total is greater than 50{% endif %}
{% if event.order.total < 50 %} Order total is less than 50{% endif %}
{% if event.order.total >= 50 %}Order total is greater than or equal to 50{% endif %}
{% if event.order.total <= 50 %}Order total is less than or equal to 50{% endif %}
Individual cart items
First product name: {{event.order.product_details[0].title}}
Third product name: {{event.order.product_details[2].title}}
Important note: Only reference object this way if you are certain they exist and always will exist as long as the API call is active. If those indices do not exist, it could cause the mail to be cancelled due to missing content. If you are not certain, then first check for the object:
{% if event.order.product_details[2] %}
{{event.order.product_details[2].title}}
{% endif %}