Magento – M2: How to add store address to transactional email / invoice email

email-templatesinvoicemagento2order-emailtransactional-mail

In M1, our invoice email templates contained the store address:

{{config path='general/store_information/address'}}

In M2, this does not work, because store information / address is split into multiple fields.

Is there an easy way how to insert the store address into transactional emails? Best with only one variable instead of an entire variables section? I would prefer a one-fits-all approach; one email template for all countries.

Best Answer

This is from Magento development docs

The selection of available variables depends on which template you use as a basis. The template-specific variables are contained in a comment at the top of each template on the file system. (For example, look at app/code/Magento/Customer/view/frontend/email/account_new.html.

You can read more https://devdocs.magento.com/guides/v2.0/frontend-dev-guide/templates/template-email.html

So you can rewrite <Magento_Email_module_dir>/view/frontend/email/footer.html and add your variable.

I found that you can also add customer variables in backend. System>Custom Variables:

And one more information: I found on Marketing => email templates=> and load Footer (Magento/luma) and this template load address using:

<p class="address"> {{var store.getFormattedAddress()|raw}}  </p>

Uptate: for Magento 2.3.4:

<p class="address"> {{var store.formatted_address|raw}} </p>

Ref: https://github.com/magento/magento2/blob/2.3/app/design/frontend/Magento/luma/Magento_Email/email/footer.html

Migrating templates:

https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/templates/template-email-migration.html

Or just switch to use legacy template in mail template table.