I can't seem to find an option to preview the different e-mail templates of Woocommerce. In the admin section of Woocommerce there is a link to preview the "Order recieved" email for customers. But I would like to edit and preview the "Order recieved" email sent to the admin.
I have tried WP Better emails plugin and the WP email template plugins but they didn't offer a preview button for all the different emails of Woocommerce.
Previewing the email templates by placing orders isn't an option because there's a lag of ten minutes between placing the order and recieving the admin email.
WooCommerce Email Templates Overview Basically, go into the woocommerce folder and navigate to the `templates` sub-folder. Inside there you'll see another sub-folder called `emails`. You can grab any and all of those files, and copy them (don't “move”) into your theme folder into `woocommerce\emails`.
Start by installing the extension from your WordPress dashboard, just as you would any other plugin. Then: Go to MailPoet → Settings → WooCommerce in your WordPress dashboard, select Use MailPoet to Customize Your WooCommerce Emails and save your settings. Click Open Template Editor.
Template files are located within the /wp-content/plugins/woocommerce/templates/ directory.
If you go to a particular option in WooCommerce Email Settings, for example 'Processing Order', you will notice a message. To override and edit this email template copy {file-path} to your theme folder: {theme/file-path}. This method allows you a more advanced option to customize WooCommerce order emails.
I ended up creating a small function which is executed via the admin-ajax.php script, e.g.
https://example.org/wp-admin/admin-ajax.php?action=previewemail&file=emails/customer-processing-order.php&order=180
The function:
$order
variable to the order with the id specified in the order
parameterfile
parameter.This is the code (you must add it a new plug-in or in some existing php):
/**
* Open a preview e-mail.
*
* @return null
*/
function preview_email()
{
global $order;
$filename = $_GET['file'];
$orderId = $_GET['order'];
$order = new WC_Order($orderId);
include $filename;
return null;
}
add_action('wp_ajax_previewemail', 'preview_email');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With