Hi,
I have a bit of an issue with configuring an email module with an IF/ELSE statement base on a transactional email template.
I know all the custom variables we send are properly added to the email (the debug print works), but whatever I do I cannot use any of them to trigger the IF logic correctly.
Attached is a screenshot of the email I’m getting where you can see that the ‘nextCharge’ parameter is correctly set as ‘true’ but the ‘nextCharge|bool’ is not being processed correctly returning and empty ‘{}’
I even went as far as creating a macro for that, with no success…
Code I’m using in the module:
<!-- isEnabledForEmailV3Rendering: true -->
{% macro test(nextChargeDate, nextCharge) %}
nextChargeDate: {{ nextChargeDate|pprint }}<br>
nextCharge: {{ nextCharge|pprint }}<br>
nextCharge|bool: {{ nextCharge|bool|pprint }}<br>
{% if nextCharge|bool == true %}
We will attempt to charge your card one more time, the next attempt will be on {{ nextChargeDate }}.
{% else %}
This was the third and last charge attempt.
{% endif %}
{% endmacro %}
{{ test(custom.nextChargeDate, custom.nextCharge) }}
-------------------------------------
Here are the custom properties I’m using for testing:
nextCharge = true
“customProperties”: {
“fullName”: “John Doe”,
“last4”: “1234”,
“transactionAmount”: “100.0$”,
“transactionDate”: “2021-06-09T16:03:59Z”,
“nextChargeDate”: “2021-06-16T16:03:59Z”,
“nextCharge”: “true”
}
nextCharge = false
“customProperties”: {
“fullName”: “John Doe”,
“last4”: “1234”,
“transactionAmount”: “100.0$”,
“transactionDate”: “2021-06-09T16:03:59Z”,
“nextChargeDate”: “”,
“nextCharge”: “false”
}
-------------------------------------
If anyone encountered this issue before, I would really appreciate an advice.
Thanks,
Art
