If you want to change the way your WooCommerce emails look, you can edit the email templates. Email templates are HTML files that control the layout and design of your WooCommerce emails. In this article, we’ll show you how to edit email templates in WooCommerce.
WooCommerce comes with a default set of email templates.
These templates are located in your WordPress theme’s folder. If you want to edit these templates, you need to copy them to your child theme’s folder. This way, when WooCommerce updates, your customizations will not be overwritten.
To copy the default WooCommerce email templates to your child theme’s folder, follow these steps:
- Navigate to Appearance > Editor in your WordPress admin.
- Click on the theme functions.php file.
- Add the following code to the end of the file:
add_action( 'woocommerce_email', 'my_custom_woocommerce_email' );
function my_custom_woocommerce_email( $email_class ) {
/**
* Get email classes
*
*/
$email_classes = array(
'WC_Email_New_Order',
'WC_Email_Cancelled_Order',
'WC_Email_Failed_Order',
'WC_Email_Customer_On Hold_Order',
'WC_Email_Customer_Processing Order',
'WC_Email_Customer _Completed Order',
'WC_Email _Customer _Refunded Order',
'WC _Email _Customer _Invoice'
); }
- Save the file.
- Now go to Appearance > Theme Editor. You should see a list of WooCommerce template files on the right hand side.
PRO TIP: If you are not a developer or comfortable with code, do not attempt to edit email templates in WooCommerce. You can break your site if you make a mistake. If you need to customize an email template, we recommend reaching out to a developer for help.
- (Optional): If you don’t see WooCommerce template files listed, then click on the “Select” drop-down at the top right and select “WooCommerce”. This will filter the files so you only see WooCommerce template files.
- (Optional): If you want to edit the CSS for your WooCommerce emails, click on the “Styles” tab at the top of the page. This will bring up the CSS for your WooCommerce emails. You can make changes here and they will be reflected in your emails.
- (Optional): If you want to override any of WooCommerce’s core functions (not recommended), click on the “Functions” tab at the top of he page. This will bring up a list of all WooCommece’s core functions that are loaded when an email is sent out.
You can override any of these functions by adding your own function with the same name.
Editing Email Templates in WooCommerce
To edit an email template in WooCommerece, follow the steps below. This is a brief guide on how to edit an email template in WooCommerce:
- Go to WooCommerce > Settings > Emails
- Select the email you wish to edit
- Click the “Edit” button next to the email subject
- Make the desired changes and click “Save Changes”
- Your changes will now be reflected in that email template.