An Easy Guide To Adding Custom Variables In Magento 2

Posted by

On the previous article, we described what are variables in Magento 2, two main type of variable and how to add variables to email templates. As we said before, variables are contain information that can be created and used in multiple places, and store administrators can create their own variables. The variables created by store owners are called custom variables, and store owners use custom variables by attach them to pages, blocks, banners, and email templates.

This article will provide a tutorial on creating and adding custom variables in Magento 2 control panel.

To create custom variables and attach them to pages, blocks, banners, and email templates, you have to know a little HTML code and how to use a markup tag.

{{CustomVar code= “my_custom_variable”}}

Custom Variables Adding Custom Variables In Magento 2
Custom Variables

To create custom variables in Magento 2 control panel, you have to follow these steps:

  1. On the admin sidebar, click System. Then under Other Settings, click Custom Variables. Click Add variables
  2. Input an identifier in the Variable Code field using lowercase and no spaces
  3. In the Variable HTML Value text field, use HTML tags to input any content you want to include. This option helps you format the value.
  4. In the Variable Plain Value text field, you can add variable value as plain text.

Tips: To enlarge the boxes, drag the right corner.

New Custom Variable Adding Custom Variables In Magento 2
New Custom Variable
  1. Click Save after completed

Above is a complete tutorial on how to add custom variables in Magento 2 control panel. We hope that store owners can handle the progress of using variables, and use all variables effectively in their online store. Leave a comment or contact email directly if you have any other ways to add custom variables. In the next article, we will describe markup tags and how to use markup tags in links. Don’t forget to track Mageguides to read more useful Magento 2 articles.

Leave a Reply

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