How to Get Config Value Inside Email Template
Customising email templates is a common task in Magento 2. But what if you want to get a system configuration value inside an email template? Let's have a look together.
First of all we will add a new system configuration in our module's system.xml file.
The new system configuration will be under the Store Information group as you can see below.
Now to make this system configuration available as variable in the email template you will need to pass it as an item for the array argument "configPaths" of the class Magento\Variable\Model\Config\Structure\AvailableVariables. That will be done by defining our custom system configuration in our di.xml.
In admin area as you see below, when you are trying to add a new variable in an email template, our custom system configuration variable is now available.
Feel free to share this post and ask your questions in the comments below.
Till next time!