skip to Main Content

I am using the default Reward email template, which is following

{{template config_path="design/email/header_template"}}

<p class="greeting">{{trans "%name," name=$customer.getName()}}</p>
<p>
    {{trans "You have %points_balance points that may be used in our store:" points_balance=$points_balance}}
    <a href="{{store url=""}}">{{var store.getFrontendName()}}</a>.
</p>
<p>{{trans '<a href="%unsubscription_url">Unsubscribe</a> from these notifications.' unsubscription_url=$unsubscription_url|raw}}</p>

{{template config_path="design/email/footer_template"}}

According to template I should receive the customer name in the email on the reward points update, but I am receiving like this

enter image description here

I am unable to understand why customer name is not display rather it is showing %name,

In email template I have tested {{var customer.getFirstName}}, {{var customer.firstname}}, {{trans "name" name="customer.name"}}, {{trans "name" name="customer.getname"}}, {{customer}}

It seems customer var is not working in email template

In the code file I have checked the files

1) vendor/magento/module-reward/Model/Reward.php

2) vendor/magento/framework/Filter/Template.php

But did not find any specific reason. I know by override etc I can add customer name explicitly but I am trying to know the exact reason why it is not working. I am using Magento 2.1.4 EE. Can you please guide me from where I can get any clue about it?

Thank You!

2

Answers


  1. <p class="greeting">{{trans "%name," name=$customer.getName()}}</p> in "%name" , "name" Conflict with System Keyword.
    Modifying "name" solves the problem.
    My File Path:
    appdesignfrontendMagentolumaMagento_Salesemail
    appcodeMagentoSalesviewfrontendemail
    eg: 
    1:<p class="greeting">{{trans "%guest_name," guest_name=$customer.getName()}}</p>
    2:<p class="greeting">{{trans "%customer_name," customer_name=$order.getCustomerName()}}</p>
    
    Login or Signup to reply.
  2. I faced a similar issue today on magento 2.3.1 with new account template. Following change fixed my problem.

    In admin, marketing, email templates, I created a new template and load the new account template.

    I changed this

    <p class="greeting">{{trans "%name," name=$customer.name}}</p>
    

    to this

    <p class="greeting">{{var customer.name}},</p>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search