How to customize email templates per channel?

Let’s assume you have two channels in your Sylius store: TOY_STORE and FASHION_WEB. You want to personalize email content depending on which channel the customer used to place an order. This guide shows how to achieve this in a maintainable and scalable way.

To verify and manage channels in your system, open the Channels grid in the Sylius admin panel. You’ll find each channel’s code, name, and hostname.

These codes are what you will use to differentiate content in your Twig templates.


1. Identify the Email Template to Override

Original template:

To override it, copy it to:

circle-check
circle-info

Twig paths like @SyliusCoreBundle/... point to the original bundle templates. To override them, create files under templates/bundles/..., following Symfony’s bundle override system.


2. Choose a Strategy

Depending on the number of channels and degree of customization, choose one of two strategies:

For 1–2 Channels with Small Differences

Use inline if conditions:

circle-check

For 3+ Channels or Maintainability

Use per-channel Twig includes with fallback:

Parent Template:

Example File Structure

Sample Channel Files

_default.html.twig

TOY_STORE.html.twig

FASHION_WEB.html.twig

circle-check

3. Understand the Default Layout

By default, the core Sylius orderConfirmation.html.twig email looks like this:

  • _subject.html.twig: contains the translated subject line

  • _content.html.twig: includes layout, order number, and optional link

circle-check

βœ… Result

Each email adapts to the right channel automatically. Developers can manage templates independently, and fallback logic ensures robustness.

You’ve now implemented clean, scalable multi-channel email templates in Sylius!

FASHION_WEB channel
TOY_STORE channel

Last updated

Was this helpful?