How to send custom Woocommerce Email
I just get a custom support request to send a custom email for a Woocommerce site, here are the request:
- send a process order email to the operation department ( Woocommerce send a process order email to client when the order status is processing )
- the email should send when order change from pending to processing or on hold to processing.
- the email content should be exactly like the process order email content.
I just duplicate the existing email class and modify for my need, save the file as email.php in the theme folder, next adding the below function on function.php, in order to turn on the email feature. What it does is include the new email class that I created and it will auto trigger based the class setting.
add_filter( 'woocommerce_email_classes', 'process_order_email' );
function process_order_email( $classes ) {
$classes['WC_Process_Order_Email'] = include( get_stylesheet_directory() . '/email.php' );
return $classes;
}