A Tutorial On Using Variables In Magento 2

Posted by
  1. What are variables in Magento 2?

Variables contain information that can be created and use in multiple places, for example: email templates, blocks, content pages. There are many predefined variables in your store that can be used to personalize communications. Of course, store administrators can create their own variables. There are two primary types of variable:

  • Predefined variables
  • Custom Variables

In this article, we will describe predefined variables and how to add variables in Magento 2 email templates.

  1. Add variables to an email template in Magento 2 admin panel

Store owners can easily add predefined variables to the content of email templates and content pages to personalize communications. Depending on the template, there are many options for variables.

Custom Variables Using Variables In Magento 2
Custom Variables

To add variables to Magento 2 email template, you can follow these steps:

  • On the admin sidebar, click Marketing > Then under Communication, click Email Templates.
  • Follow one of these steps: Load an existing template or add a new template.
  • In the Template Content box, place the insertion cursor to the position where you want to insert the variable into the template. Click Insert Variable
  • Select the type of variable you want to insert
  • Click preview if you want to preview the variable template first
  • Click Save Template after complete

Above is a part of guideline on using variables in Magento 2 and tutorial on adding variables to an email template. If you have another way to add variables, you can share with us in a comment or email us directly. You can also leave a comment if you have any question about this tutorial. Keep tracking Mageguides using subscribe box to read more Magento 2 articles. In the next article, we will describe what is custom variables and how to create and add custom variables in Magento 2 admin control panel.

Leave a Reply

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