O'Reilly logo

Magento 2 Developer's Guide by Branko Ajzele

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Custom variables

Variables are a handy little feature of a core Magento_Variable module. Magento allows you to create custom variables and then use them in e-mail templates, the WYSIWYG editor, or even code expressions.

The following steps outline how we can create a new variable manually:

  1. In the Magento admin area, navigate to System | Other Settings | Custom Variables.
  2. Click on the Add New Variable button.
  3. While keeping in mind the Store View switcher, fill in the required Variable Code and Variable Name options, and preferably one of the optional options, either Variable HTML Value or Variable Plain Value.
  4. Click on the Save button.

Now that we have created the custom variable, we can use it in an e-mail template or the WYSIWYG editor by calling it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required