How to Customize Message Template in Magento 2

Posted by

What is Message Template in Magento 2?

Message Template in Magento 2 is a form of notification message which is specified for each activity or event that activate notification. The progress of changing the content of each message is similar to changing the header of footer email template. There is a difference in message template, every email template is specified for each activity or event that activate a notification. You can use the default message template in Magento 2 or edit them to match your store and brand name. There are much selection of variables that can be attached to a template, in addition to a template text. In this article, we will show you how to customize Message Template in Magento 2 Configuration.

Follow these steps to customize Message Template in Magento 2 Configuration

Step 1: Load the Default Template

  1. On the Admin sidebar, click Marketing. After that, under Communications, choose Email Templates.
  2. Click Add New Template. After that, follow these steps:
  • In the Template list under Load default template, select the template that you want to customize.
  • Click Load Template.
magento-2-email-templates-message-load-default
Default Message Template

Step 2: Customize the Template

  1. In the Template Name field, input a name for your custom template.
  2. Normally, the Template Subject includes the first line of the message, which is the greeting. You can use the default content, or add something else.
  3. Remember the Currently Used For path to the template configuration. To update the configuration, you have to follow this path later.
magento-2-email-template-message-information
Message Template Information
  1. In the Template Content box, edit the HTML as you wished. The content comprises a combination of text, HTML tags, CSS codes, and variables.

Be careful not to override the code that is enclosed in double braces while working in the template code.

magento-2-email-template-message-content
Template Message Content
  1. To add a variable, firstly you have to place the cursor in the code where the variable will appear, then click Insert Variable. After that, select the variable you want to add.

A marked up tag for the variable is added to the code after chosen a variable

magento-2-email-template-insert-variable
Insert Variable
  1. Input the CSS styles in the Template Styles box if you want to create any CSS declarations.

Step 3: Update the Configuration

  1. Find the following information that relates to your templates at the top of the Template Information section
Page Customer Configuration
Section Create New Account Options
Field Default Welcome Email
  1. To open the template configuration page, click the link.

magento-2-email-template-new-currently-used-for

  1. Open the section. Find the field for the customized email template that you just edited before, and determine the new template as the default.
magento-2-email-template-message-configuration-default-template
Welcome Email Configuration

Step 4: Preview and Save the Template

  1. Click Preview Template to preview your customized template, make any changes to your template as needed.
  2. Click Save Template after you’re done. Now your customer email template is now available in the list of Email templates.

magento-2-email-templates-grid-new-account-template

Field Descriptions

 

FIELD DESCRIPTION
LOAD DEFAULT TEMPLATE
Template The choice of available templates will be listed and recognizes the template to be customized
TEMPLATE INFORMATION
Template Name The name of your custom template.
Insert Variable a Store Contact Information variable can be inserted into the template at the cursor location.
Template Subject In the Subject column, the Template Subject displayed to sort and filter the templates in the list.
Template Content The HTML content of the template.
Template Styles In the Template Styles box, you can enter any CSS style declarations to format the template header.

 

Leave a Reply

Your email address will not be published. Required fields are marked *