1

I want to override a Magento 2 email in adminhtml, has anyone done this already and what is the correct way to do this?

I have tried it like this: app/design/{vendor}/{theme}/{module}/email

Thank you!

| improve this question | | | | |
  • Which email template you need to override? – Suresh Chikani Jun 26 '17 at 13:33
  • A custom module's adminhtml email file – Jelle Siderius Jun 27 '17 at 7:04
  • Add your custom module path. – Suresh Chikani Jun 27 '17 at 7:05
0

Found it out myself!

1) I have created a custom module:

app/code/Vendor/Module/registration.php

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Vendor_Module',
    __DIR__
);

app/code/Vendor/Module/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Theme\Model\View\Design">
        <arguments>
            <argument name="themes" xsi:type="array">
                <item name="frontend" xsi:type="string">Magento/luma</item>
                <item name="adminhtml" xsi:type="string">Vendor/backend</item>
            </argument>
        </arguments>
    </type>
</config>

app/code/Vendor/Module/etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_Module" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Backend"/>
        </sequence>
    </module>
</config>

2) in CLI use php -d memory_limit=-1 bin/magento setup:upgrade

3) After creating the module itself i have created the adminhtml folder:

app/design/adminhtml/Vendor/backend/registration.php

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'adminhtml/Vendor/backend',
    __DIR__
);

app/design/adminhtml/Vendor/backend/theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>Vendor backend Theme</title>
    <parent>Magento/backend</parent>
</theme>

4) And in the custom adminhtml folder you can now rewrite anything, i made a rewrite for the following file like this:

app/design/adminhtml/Vendor/backend/Module_Name/email/tracking.html
| improve this answer | | | | |
-1

There a way to customize an email template, that is using Magento Admin - Email Templates

You can refer to this link: http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/templates/template-email.html#customize-email-admin

| improve this answer | | | | |
  • Hi Walish Le, thank you for your response, i am aware of the way of editing like that. But i want to override the file, so that it wont be in the system but in the file structure. – Jelle Siderius Jun 26 '17 at 11:33
-1

See my below example for override email template

For Example if you want to override customer new account email template

Copy email template from

vendor/magento/module-customer/view/frontend/email/account_new.html

to

/app/design/frontend/Vendor/YourTheme/Magento_Customer/email/account_new.html

| improve this answer | | | | |
  • Hi S H Patel, thanks for your response but this is for overriding frontend templates, not adminhtml templates right? – Jelle Siderius Jun 27 '17 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.