How to Customize Email Templates in Magento 2

Magento 2 comes with lots of functionalities. One of the best features of Magento 2 for merchants is that it sends emails on certain actions, like new order, customer information, newsletter and more.

Merchants start their stores on Magento 2 and get lots of orders, but after launching operations of a Magento 2 store, every merchant wants to communicate with his customers. Email is one of the most traditional channels to communicate with clients. After customizing the look and feel of a Magento website, it is nice if the store’s email template also has the same look.

Magento 2 provides us a default email template for the body section of the individual message that is sent by the Magento system.  But sometimes merchants do not like the default Magento 2 email template, and they want to customize their email templates. In this article, I’m going to show you how you can customize email templates of your Magento 2 store.

Customize Email Templates Using the Magento 2 Admin

Magento 2 allows us to make an email template for the body content, which is combined with the header and footer to create the complete message. Content is formatted with HTML and CSS and it can be easily customized by adding variables and fronted apps. The default template includes logo and store information too, and it can be used without further customization. Let’s start!

  • Log in to your Magento 2 admin and go to Marketing > Communications > Email Templates  

Navigation-Email Templates

In the “Email Templates,” you can see “Add New Template” Button on top.

Add-New-Templates

If you want to use default templates which the Magento systems provides as a starting point in the “Load default template” section, choose the template which you want to use and click on “Load Template” button. The path to the configuration settings for every default template shows in the “Currently Used For” field in the template information area.

Load-default-template

Template Name: In this field enter a name of your template, identified in the Magento Admin.

Template Subject: In this field add plain text to use as the Subject of the emails sent using the template you created.

Template Content: I discussed this field in detail below, under “Customize Your Email Content.”

Template Styles: Here we can optionally add CSS styles to our template.

Click on the “Save Template” button.

Now, we have successfully created a template. After that we must configure this template to be used.

  • Go to Stores > Settings > Configuration > Sales > Sales Emails
  • In the Sales “Emails section” enable “Asynchronous sending” and select your template. We are creating template for “New Invoice”.

Configuration-Invoices

Note: If we create the template for “Shipment” or “Order” then we must select our template in these fields.

  • Select your template from the list which you created,
  • Click on “Save Config” button.

Customize Your Email Content

To add your store and sales related information to a template, the Magento system offers us to use system variables. We can create our custom Variables and set their values in the Magento 2 Admin under System > Custom Variables

To add variable in your template content:

Go to Marketing > Communications > Email Templates and open the template which you created earlier or create a new template. When you open your created template, click on the “Insert Variable” button

Insert-Variable-button

A popup containing a list of variables opens.  

Variables-List

Click the name of the variable which you require. Variable code is inserted in template content field. And then save your template.

Conclusion

With this tutorial you can easily customize and make your store email template, and it can make a excellent impact on your customers. Feel free to ask any question in the comment section below.

1 Comment

Leave A Reply