Is it possible to conditionally check and decide if var:<my_var> is null | not null?
I am might be missing something obvious, but so far did not find how to do it in https://dev.mailjet.com/email/template-language/.
Hacky approach which works:
{% set my_var = var:my_var:"N/A" %}
{% if my_var != "N/A" %}
{{my_var}}
{% endif %}
This is what we are using too, but I would recommend adding a check for an empty string too.
Mailjet API sometimes doesn't like to accept null properties.
<mj-raw>
{% set my_var = var:my_var:"N/A" %}
{% if my_var != "N/A" and my_var != "" %}
</mj-raw>
... some html ...
<mj-raw>
{% endif %}
</mj-raw>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With