How to Add a Custom Variable in Magento 2

How to Add a Custom Variable in Magento 2

In one of my previous articles I explained how to add variables in M2. But the list of default variables is limited. In this article you will find how to create custom variables.

First of all, navigate to System -> Custom Variables

How to Add a Custom Variable in Magento 2

In Variable Code enter the code of the variable without spaces and in lowercase letters. Somehting like working_hours.

Then enter the proper name of the Variable (it’s for internal use only, don’t worry).

Variable HTML Value: enter custom HTML code for your variable. (can skip it if don’t want any particular formatting for your plain text).
Variable Plain Value: Here you can enter the text for the variable. Here you can write, for example, that your working hours are from 12 am to 12 pm. Then, you can use this value on multiple pages of your store. And in variables you can change the value and won’t have to make changes on all pages of your store.

How to Add a Custom Variable in Magento 2



Post a new comment

top