WooCommerce: Resend Any Order Email

How annoying is the fact you can only resend the “New Order Notification” from the single order admin page? What if you’re testing out and customizing email templates, and need to email yourself the “processing” or the “completed” notification, without having to place a new test order or switching order status twice to re-trigger the notification?

Well, today we will see how to add a “Resend whatever email” function under the “order actions” on the single order edit page. Of course, make sure you switch the billing email to yours, otherwise the customer will get these emails and not you. Enjoy!

How poor from WooCommerce that you can’t resend a “completed” email notification (for example) from the Order actions! Let’s change that with a simple customization!

PHP Snippet: Allow Administrator to Resend Any Order Email

In this case, I’ve targeted the “customer processing” email. In order to do that, I’ve created a custom Order action (please note the custom ‘resend_processing‘ order action ID, because that’s used later in the trigger ‘woocommerce_order_action_resend_processing‘, so if you change that you also need to change the ‘woocommerce_order_action_{action}” hook name).

Also, you’ll need to call the correct email class, in my case: WC_Email_Customer_Processing_Order. See notes after the snippet to target other emails.

/**
 * @snippet       Resend Processing Email @ WooCommerce Order Admin
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 8
 * @community     https://businessbloomer.com/club/
 */

add_filter( 'woocommerce_order_actions', 'bbloomer_resend_processing_email_action', 9999, 2 );

function bbloomer_resend_processing_email_action( $actions, $order ) {
	if ( $order->has_status( wc_get_is_paid_statuses() ) ) {	
		$actions['resend_processing'] = 'Resend processing email';
	}
	return $actions;
}

add_action( 'woocommerce_order_action_resend_processing', 'bbloomer_resend_processing_email_trigger' );
 
function bbloomer_resend_processing_email_trigger( $order ) {
	WC()->mailer()->emails['WC_Email_Customer_Processing_Order']->trigger( $order->get_id(), $order, true );
}

If you want to target other emails:

  1. Add one more line to bbloomer_resend_processing_email_action() e.g. $actions[‘resend_completed’] = ‘Resend completed email’;
  2. Create a custom order action listener based on previous point e.g. add_action( ‘woocommerce_order_action_resend_completed’, etc.
  3. Declare your custom function: instead of bbloomer_resend_processing_email_trigger() use e.g. bbloomer_resend_completed_email_trigger()
  4. Inside the function, call the relevant class (in our case: ‘WC_Email_Customer_Completed_Order‘)

Example:

/**
 * @snippet       Resend Completed Email @ WooCommerce Order Admin
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 8
 * @community     https://businessbloomer.com/club/
 */

add_filter( 'woocommerce_order_actions', 'bbloomer_resend_completed_email_action', 9999, 2 );

function bbloomer_resend_completed_email_action( $actions, $order ) {
	if ( $order->has_status( wc_get_is_paid_statuses() ) ) {	
		$actions['resend_completed'] = 'Resend completed email';
	}
	return $actions;
}

add_action( 'woocommerce_order_action_resend_completed', 'bbloomer_resend_completed_email_trigger' );
 
function bbloomer_resend_completed_email_trigger( $order ) {
	WC()->mailer()->emails['WC_Email_Customer_Completed_Order']->trigger( $order->get_id(), $order, true );
}

Here’s the list of default WooCommerce email classes:

  • WC_Email_Cancelled_Order
  • WC_Email_Customer_Completed_Order
  • WC_Email_Customer_Invoice
  • WC_Email_Customer_New_Account
  • WC_Email_Customer_Note
  • WC_Email_Customer_On_Hold_Order
  • WC_Email_Customer_Processing_Order
  • WC_Email_Customer_Refunded_Order
  • WC_Email_Customer_Reset_Password
  • WC_Email_Failed_Order
  • WC_Email_New_Order

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: Add Second Description @ Product Category Pages
    In terms of SEO, if you’re trying to rank your product category pages, you really need to make the most of the default WooCommerce product category “description” and “thumbnail”. Most themes, if compatible with WooCommerce, will show this content right below the product category name and above products. Nothing new so far. But what if […]
  • WooCommerce: Add Content to a Specific Order Email
    Customizing WooCommerce emails via the WordPress dashboard is not easy and – sometimes – not possible. For example, you can’t edit or add content to them unless you’re familiar with code. Well, here’s a quick example to learn how to add content to any WooCommerce default order email. In this case study, our goal is […]
  • WooCommerce: How to Add a Custom Checkout Field
    Let’s imagine you want to add a custom checkout field (and not an additional billing or shipping field) on the WooCommerce Checkout page. For example, it might be a customer licence number – this has got nothing to do with billing and nothing to do with shipping. Ideally, this custom field could show above the […]
  • WooCommerce Visual Hook Guide: Emails
    WooCommerce customizers: the Visual Hook Guide is back! Here’s a visual HTML hook guide for the WooCommerce Emails. This visual guide belongs to my “Visual Hook Guide Series“, that I’ve put together so that you can find WooCommerce hooks quickly and easily by seeing their actual locations. Let me know in the comments if this […]
  • WooCommerce: Create a Custom Order Status
    All WooCommerce orders go to either “processing”, “completed”, “on-hold” and other default order statuses based on the payment method and product type. Sometimes these statuses are not enough. For example, you might need to mark certain orders in a different way for tracking, filtering, exporting purposes. Or you might want to disable default emails by […]

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

8 thoughts on “WooCommerce: Resend Any Order Email

  1. Hi
    how can we add resend order completed emails to this code.
    Thanks

    1. Good point, thank you. I’ve added more info to the tutorial now – let me know!

  2. Hi,
    Thanks !
    Why don’t you add on hold action ?

    function bbloomer_resend_processing_email_action( $actions, $order ) {
       if ( $order->has_status( wc_get_is_paid_statuses() ) ) {   
          $actions['resend_processing'] = 'Resend processing email';
       }
    if ($order->has_status( 'on-hold' )) {
    	$actions['resend_on_hold_email'] = 'Resend on hold email';
       }
       return $actions;
    }
    
    add_action( 'woocommerce_order_action_resend_on_hold_email', 'am_resend_processing_email_trigger');
    
    function am_resend_processing_email_trigger( $order ) {
        WC()->mailer()->emails['WC_Email_Customer_On_Hold_Order']->trigger( $order->get_id(), $order, true );
    }
    
    
  3. Hello
    can you add a text with a link to the customer’s email to quickly reply to the order email? I tried to add links in the admin-new-order.php template but I can’t get the recipient to appear in the email window… the field is empty

    1. Hello Micol, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  4. You don’t need a comment section to posts because you never reply to any of them.

    1. Wow, thank you for your honest feedback

Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Your email address will not be published. Required fields are marked *