When creating a custom email header for a email template it gives an error in the email's body.

Error filtering template: Email template '' is not defined

I have placed in the header using this convention in the email template body (which is just overridden in the theme email)

{{template config_path="design/email/design_email_header_changed_template"}}

I have put the template id into email_templates.xml inside the main module (I know it's bad practice, but for now, please humour me till I fix the main issue)

It is as if it doesn't find it's name for whatever reason or something? It is literally two ' in a row with no name. I did at the time have a - in the label in the section below. It might not have liked that?

<template id="design_email_header_changed_template" label="Header Changed" file="changed_header.html" type="html" module="Magento_Email" area="frontend"/>

I have put the template header in the module under the frontend folder on the root as well as the theme folder (again, I know bad practice, but I'm just trying to figure out what is going on).

I have also updated the config.xml to include the header template:


I am unsure of what I am doing wrong for the system to not retrieve the html file to spit out the template or, rather find the template.


  • i have same issue Nov 27, 2018 at 14:07
  • Please see my answer below -- it may be a good workaround to your issue.
    – GuitarKat
    Nov 28, 2018 at 23:21

2 Answers 2


I couldn't fix the main issue, so this is what I did.

I made the "header" kind of extend to the email body. For example, order_email.html and added a CMS block call to there (I know, right!). Within the main admin area, I created a new CMS block and pasted the image (in my case) there. I made sure to name the block so I would be able to call it in the email.

In certain emails where I wanted the CMS block to show, I did this (Magento_Sales/email/order_new.html) - in a template (var/www/magento2/..../app/design/frontend/theme_name/Magento_Sales/email/order_new.html)- as an example:

{{block class="Magento\Cms\Block\Block" area='frontend' block_id="thank_you"}}

Hope this helps someone! :)


In Magento 2.3.5, I came across this issue around virtual/physical Gift Card Product. Even though the Gift Card admin configurations were correctly set in Admin > Sales > Gift Cards > Gift Card Email Settings > Gift Card Notification Email Template, whenever I was invoicing an gift card order it was throwing an error saying - There was an error creating the invoice. And in the var/log/exception.log file I was seeing the following error:

report.CRITICAL: Email template '' is not defined. {"exception":"[object] (UnexpectedValueException(code: 0): Email template '' is not defined. at /vendor/magento/module-email/Model/Template/Config.php:225)"} []

The fix was to:

  1. Create a new template for Gift Card Notification Email Template in Admin > Marketing > Email Templates
  2. Assign this newly created template in the gift card product edit page under Gift Card Information tab
  3. Also assign the same template in Admin > Sales > Gift Cards > Gift Card Email Settings > Gift Card Notification Email Template.
  4. Clear cache and the error was fixed and invoice creation was successful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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