Jump to content

Custom Email Templates Ignored in Order Status Preview (PS 9)


ptityop

Recommended Posts

I’m having a very confusing issue with email templates in PrestaShop 9, specifically when using the email preview from the “Order status” section in the Back Office.

When I started testing email previews, I noticed that the templates being rendered were not the ones I had customized. Because PrestaShop 9 introduced many changes compared to previous versions, I assumed this might be related to how email templates are now resolved.

To eliminate ambiguity, I took the following steps:

- I copied all email templates from the custom theme/mails folder into both the classic and modern themes.
- I then tested which location was actually being used by the preview system.

Through testing, I realized that:

- The email preview only works when /mails/themes/classic exists.
- If I rename or remove /mails/themes/classic, the email preview stops working entirely.

This strongly suggests that /mails/themes/classic is the only folder triggering email previews.

To further isolate the issue:

In my custom theme, I renamed the mails folder so it cannot be used.

In the core /themes directory, I renamed all themes except classic, so there should be only one possible source for email templates: /mails/themes/classic

Despite this, I’m still seeing generic email content in the preview, The main email body does not reflect my customized templates from the language folder, However, changes made to footer.twig are reflected (for example, removing “Powered by PrestaShop”). So something is being loaded from my customized files — but only partially.

Also.

I clear the cache every time I make changes (manually from the file manager) , I have left only one language folder inside /mails/themes/classic, even so, the email body content does not seem to come from that language folder at all.

At this point, I’m stuck because:

There is only one possible mail template location left.
Parts of my customizations are applied.
But the main email content is still coming from what looks like a fallback or generic source.

Clearly, I’m missing something in how PrestaShop 9 resolves or composes email templates, but I can’t identify what it is.

If anything in this explanation is unclear, I’m happy to reformulate — but I hope someone familiar with PrestaShop 9’s email system can point out what I’m overlooking.

Edited by ptityop (see edit history)
Link to comment
Share on other sites

  • ptityop changed the title to Custom Email Templates Ignored in Order Status Preview (PS 9)

Hi,

In PrestaShop 9 the “Order status” email preview isn’t driven only by the old /mails/en/*.html files anymore. It uses the Twig email theme system, so it’s normal that footer.twig changes show up (Twig layout), while the main body still looks generic if you’re editing the wrong layer.

What to do:

  • BO → Design > Email theme: select your email theme and click Generate.
  • Edit the Twig templates in /mails/themes/classic/ (templates/layouts/components), not just the language folder.
  • Clear cache.

And yes, preview breaking when /mails/themes/classic is missing looks like a fallback/bug, keep that folder.

Edited by wepresta (see edit history)
  • Like 2
Link to comment
Share on other sites

9 hours ago, ptityop said:

I’m having a very confusing issue with email templates in PrestaShop 9, specifically when using the email preview from the “Order status” section in the Back Office.

When I started testing email previews, I noticed that the templates being rendered were not the ones I had customized. Because PrestaShop 9 introduced many changes compared to previous versions, I assumed this might be related to how email templates are now resolved.

To eliminate ambiguity, I took the following steps:

- I copied all email templates from the custom theme/mails folder into both the classic and modern themes.
- I then tested which location was actually being used by the preview system.

Through testing, I realized that:

- The email preview only works when /mails/themes/classic exists.
- If I rename or remove /mails/themes/classic, the email preview stops working entirely.

This strongly suggests that /mails/themes/classic is the only folder triggering email previews.

To further isolate the issue:

In my custom theme, I renamed the mails folder so it cannot be used.

In the core /themes directory, I renamed all themes except classic, so there should be only one possible source for email templates: /mails/themes/classic

Despite this, I’m still seeing generic email content in the preview, The main email body does not reflect my customized templates from the language folder, However, changes made to footer.twig are reflected (for example, removing “Powered by PrestaShop”). So something is being loaded from my customized files — but only partially.

Also.

I clear the cache every time I make changes (manually from the file manager) , I have left only one language folder inside /mails/themes/classic, even so, the email body content does not seem to come from that language folder at all.

At this point, I’m stuck because:

There is only one possible mail template location left.
Parts of my customizations are applied.
But the main email content is still coming from what looks like a fallback or generic source.

Clearly, I’m missing something in how PrestaShop 9 resolves or composes email templates, but I can’t identify what it is.

If anything in this explanation is unclear, I’m happy to reformulate — but I hope someone familiar with PrestaShop 9’s email system can point out what I’m overlooking.

In PrestaShop 9, the order status email preview does not use your theme’s custom email templates.
The preview pulls emails from the core fallback location, not from overridden theme folders.
This is expected behavior and does not reflect what customers actually receive.
Actual emails sent to customers will still use the correct theme and language templates.
The preview tool is mainly for basic testing, not full template validation.

  • Like 2
Link to comment
Share on other sites

Thanks all for your replies,by miracle i finally got things sending right template but still makes no sense, still trying to work out where the info is being pulled out from. So as test I tried to modify the order_conf.txt, just adding some dummy text that should show up even in the admin preview. So here are all the paths I have tried 

/mails/fr/order_conf.txt (i know this should not exist but i tried just in case)
/mails/themes/classic/mails/fr/order_conf.txt

/mails/themes/MyCustomTheme/mails/fr/order_conf.txt
/themes/MyCustomTheme/mails/fr/order_conf.txt

Cleared cache and refreshed after each change, why the hell I am not seeing the changes yet ... driving me mad 🙂

Is there some cache to be cleared in the admin ? Because i see that when I preview the url is adminxxxx/improve/design/mail_theme/preview/classic

Edited by ptityop (see edit history)
Link to comment
Share on other sites

10 hours ago, ptityop said:

Thanks all for your replies,by miracle i finally got things sending right template but still makes no sense, still trying to work out where the info is being pulled out from. So as test I tried to modify the order_conf.txt, just adding some dummy text that should show up even in the admin preview. So here are all the paths I have tried 

/mails/fr/order_conf.txt (i know this should not exist but i tried just in case)
/mails/themes/classic/mails/fr/order_conf.txt

/mails/themes/MyCustomTheme/mails/fr/order_conf.txt
/themes/MyCustomTheme/mails/fr/order_conf.txt

Cleared cache and refreshed after each change, why the hell I am not seeing the changes yet ... driving me mad 🙂

Is there some cache to be cleared in the admin ? Because i see that when I preview the url is adminxxxx/improve/design/mail_theme/preview/classic

Because your preview URL is .../mail_theme/preview/classic, you’re previewing the Twig email theme “classic”, not the legacy /mails/fr/order_conf.txt. So editing order_conf.txt won’t show up there.

Do this:

  • Edit the Twig template under /mails/themes/classic/ (not /mails/fr/).
  • BO → Design → Email theme → Generate (for your language).
  • Delete /var/cache/* and refresh.

There isn’t a separate “admin cache” for this beyond regenerating + clearing /var/cache.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...