How to customize notification emails depending on different return options?
Our RMA extension allows customer to have in the same RMA items with different return options. However, you can split your email template into parts, which will be included to the final email. Magento 2 provides a special condition block, called {{depend XXX}}
, where XXX is boolean-like condition.
Our extension provides three variables, which allow to check presence in current RMA items with certain properties:
{{var rma_getHasItemsWithReason_XXX}}
- allows to check, whether RMA has items with Reason, which have ID=XXX.{{var rma_getHasItemsWithCondition_XXX}}
- allows to check, whether RMA has items with Condition, which have ID=XXX.{{var rma_getHasItemsWithResolution_XXX}}
- allows to check, whether RMA has items with Resolution, which have ID=XXX.
Include these variables to {{depend XXX}}
block to have different messages for different return options.
Task: have different messages for a different conditions Unopened (ID=1), Opened (ID=2) and Damaged (ID=3). Solution: add to the email template (in Status, for example) the following code:
{{depend rma_getHasItemsWithCondition_1}}
Your items are unopened, so you can have a replacement. Please, wait for a call from our staff.
{{/depend}}
{{depend rma_getHasItemsWithCondition_2}}
Your items are opened, so please, allow our specialist to check, whether issue existed before using.
{{/depend}}
{{depend rma_getHasItemsWithCondition_3}}
Your items are damaged, so we can not do a replacement for you at all.
{{/depend}}
This approach will work both in auto-replies in Statuses, and in notifications, created by Workflow rule.