The easiest way to preview your WooCommerce emails as a reference while you customize them in your theme.
See full write-up about Customizing and Previewing WooCommerce Emails here
The Problem
WooCommerce enables you to customize your emails very easily, except for one important detail: You can't preview the email without triggering it to be sent to your email address.
The Solution
This snippet does two things for you:
Requirements
Clone or download and extract this repository into your theme's my-theme/woocommerce
directory. The end result should look like this:
Now you need to require the woo-preview-emails.php
file in your themes function.php
file. Here is an example:
/**
* Preview WooCommerce Emails.
* @author WordImpress.com
* @url https://github.com/WordImpress/woocommerce-preview-emails
* If you are using a child-theme, then use get_stylesheet_directory() instead
*/
$preview = get_stylesheet_directory() . '/woocommerce/emails/woo-preview-emails.php';
if(file_exists($preview)) {
require $preview;
}
NOTE: If your theme or child theme puts functions in a sub-folder, you'll need to update that path to point to the woocommerce/emails
folder, it just has to be a relative path. For 90% of all WordPress themes if you just put that in your root functions.php file in your theme you'll be gold.
You can now see the your previews by going to your WordPress Dashboard, and navigate to "WooCommerce > Settings" and click on the "Emails" tab. At the top of the very first sub-tab, called "Email Options", you should see a new section called "Preview Email Templates".
You now also can copy over any of the WooCommerce email templates into this emails
folder and you'll be able to customize them there directly. You can read about that here.
After you click on the link you'll be able to see your email templates.
You'll also notice the select options which allow you to dynamically select which template you'll be previewing. Some templates are populated with order information. When you select a template that has order information, a "order" field will appear so you can see the live data populated in the template.
templates\emails
folder. Copy them into the woocommerce\emails
and edit to your hearts content.We build impressive Plugins and Themes for your WordPress website. Find out more about us and read more great tutorials at https://wordimpress.com