One of the most flexible and recommended ways to customize WooCommerce email templates is by overriding them in your own theme. This approach ensures that your customizations won’t be lost when WooCommerce updates, making it a safer and more maintainable option. You need some technical knowledge to make these customizations. Here’s how you can do it:
Step 1: Locate the WooCommerce e-mail template files
Before you can customize WooCommerce email templates, you need to find the template files. These files are located within the WooCommerce plugin directory. To override them, you’ll need to copy the specific template you want to customize to your theme’s directory.
Here’s how you can find the template files:
1. Connect to your WordPress site’s server using an FTP client or a file manager provided by your hosting provider.
2. Navigate to wp-content/plugins/woocommerce/templates/emails/
.
Step 2: Create a folder in your theme
Next, you need to create a folder in your WordPress theme directory to hold the customized email templates. In your theme’s directory (usually located at wp-content/themes/your-theme/
), create a folder called woocommerce
if it doesn’t already exist. Make sure you only make customizations in a child theme. Never in a parent theme, because when a parent theme gets an update, you probabaly will lose any adjustments you made. You can read more about creating a child theme on the official WordPress website.
Step 3: Copy and customize the e-mail templates
Copy the email template you want to customize from the WooCommerce plugin directory to your theme’s `woocommerce/emails/` folder. For example, if you want to customize the “New Order” email template, copy `new-order.php` to `wp-content/themes/your-theme/woocommerce/emails/`.
Now, you can open the copied template file and make any desired customizations. You can modify the HTML, add custom text, or even change the entire layout to match your brand’s style.
Step 4: Save and Activate
After making your customizations, save the template file. WooCommerce will now use the template in your theme directory instead of the default one. Your custom text and any other changes will be included in the email.
Step 5: Test Your Customized Email
To ensure that your customizations are working as expected, place a test order on your WooCommerce site and check the email notification. Verify that your custom text appears as intended. Or use our Easy E-mail Customizer for WooCommerce plugin to preview your e-mails in realtime without the need to place a test order.
By following these steps, you can easily customize WooCommerce email templates to match your brand’s style and add any necessary custom content. Overriding templates in your theme is a safe and maintainable way to ensure that your changes persist across WooCommerce updates.
Alternative way to add custom texts to your WooCommerce e-mails
An alternate way to add texts to your e-mails is by using hooks which are available within the e-mail templates.
Here’s an example of how to add custom text to the “New Order” email template, just above the order table:
// Add custom text to the "New Order" email template add_action('woocommerce_email_before_order_table', 'add_custom_text_to_new_order_email', 10, 4); function add_custom_text_to_new_order_email($order, $sent_to_admin, $plain_text, $email) { if ('new_order' === $email->id) { echo '<p>Your custom text goes here.</p>'; } }
A list of all hooks used to add your own texts are (some are dependable on the e-mail):
- woocommerce_email_header
- woocommerce_email_footer
- woocommerce_email_order_details
- woocommerce_email_order_meta
- woocommerce_email_customer_details
- woocommerce_email_before_order_table
- woocommerce_email_after_order_table
This way you can add your own HTML and texts to the e-mails. You can only use this to add text, not modify any of the existing texts WooCommerce uses. With our Easy E-mail Customizer for WooCommerce plugin you can edit all texts, including overwriting the texts WooCommerce uses.