Custom variables

Custom variables are pieces of HTML code that contain specific values as programming variables. By creating a custom variable, you can apply it to multiple areas on your site. An example of the custom variable structure is shown here:

{{config path="web/unsecure/base_url"}}

This variable shows the URL of the store.

Now, let's create a custom variable to see how it works. Perform the following steps:

  1. Open your favorite browser and access the admin area through http://localhost/packt/admin_packt.
  2. Navigate to System | Custom Variables
  3. Then, click on the Add New Variable button.
    Custom variables
  4. In the Variable Code field, enter the variable in lowercase ...

Get Magento 2 - Build World-Class online stores now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.