Magento 2 : Email template issue
-
16-04-2021 - |
Question
I am sending a string from helper file to email template
$templateVars = [
'store_credit_amount' => $storeCredit
]; // $15
In email template html file i use it like
<p style=" text-decoration: none; font-size: 13px; font-family: arial;">
You’ve got < span style ="color: #F3198F;"> {{var store_credit_amount}} </ span> in store credit.</p>
But in email template which i get on email id, it shows span tag separately
When i add static number in email template it appears fine. Not sure how to solve this, any thoughts ?
Solution
This is fixed using {{var store_credit_amount | escape }}
OTHER TIPS
You can try this
<p style="" text-decoration: none; font-size: 13px; font-family: arial;"">
{{trans ""You’ve got ""}}
<span style=""color: #F3198F"">{{var store_credit_amount}}</span>
{{trans ""in store credit.""}}
</p>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange