Customize Emails by Overriding Templates via your Theme

Overriding our templates (just like overriding templates in WooCommerce) gives you the ability to copy our templates to your theme (or child-theme) then customize the code to your own requirements. Your modified template will override ours until you chose to delete your file and your changes will not be lost each time we update our plugins templates, but this also means that any template you override will be your responsibility to keep up to date in future - you will need to copy any future code changes we make to our templates over to your custom overridden templates. In this document we will show you how to successfully override our templates in this way.

It's worth noting that you will need to be a developer with coding skills in order to override templates and maintain the templates in future.

 

1. Copy our template to your theme (or child-theme)

Find the template you'd like to customize - in our example we're going to customize the email-header.php from our Vanilla email theme (see the image below for where to find the file). Then create a folders in your theme (or child-theme) called .../superstore-child/woocommerce/emails/vanilla/ - in our example the child theme is superstore-child (see the image below for more on this folder structure). Once you've done this, you will be able to edit the new overriding template knowing that when you update our Email Customizer plugin you will not lose your customization's.

folder-structure

 

2. Edit this new overriding template in your theme (or child-theme)

Editing the overriding .php template file is up to you and what customization you'd like to do. In our example we're going to remove the header image (logo) and the nav links to simplify the email. While editing the code you can use Email Customizer to preview your changes until you're happy with your customizations.

edit-file

 

3. Use Email Customizer to keep track of your overriden templates

To help with template overrides we've added Template Info to the Email Customizer preview. By choosing to Show Header & Template Info you will be able to see which templates are being used in the email that you are previewing and, specifically, which templates are being overridden by you. We use color codes to further help you identifying templates so please read the descriptions below to see what each color pertains to. The red Overridden templates is important here as (mentioned above) any template you override will be your responsibility to keep up to date in future - you will need to copy any future code changes we make to our templates over to your custom overridden templates.

customizer-preview

 

[the end]

 

Be the first to post a comment.

Add a comment