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 ?

  • can you please share whole code you are using to print the line. Apr 5, 2021 at 5:16
  • It has been fixed. Thanks for the comment
    – devhs
    Apr 5, 2021 at 5:29

2 Answers 2


This is fixed using {{var store_credit_amount | escape }}


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.""}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.