Since WooCommerce 3.2 the option to resend the admin new order email was removed. The reason was that it was a pretty much-unused feature as admins already have access to the orders so they could just look it up.

However, if you relied on this feature for some reason and now all of sudden can’t use it, fear not as it can easily be added back with the following snippet.

As always include the following code in your theme’s functions.php file omitting the opening <?php tags


<?php
/**
* This adds back an option to resend the admin new order email from the order edit screen that was removed in WooCommerce 3.2
*/
/**
* Filter to add a new menu to the dropdown
*
* @param array $actions
* @return array
*/
function add_resend_admin_order_email_action( $actions ) {
$actions['send_admin_order_details'] = __( 'Email order details to Admin', 'woocommerce' );
return $actions;
}
add_filter( 'woocommerce_order_actions', 'add_resend_admin_order_email_action', 10, 1 );
/**
* Hook into newly added send_admin_order_details to handle sending of admin emails
*
* @param $order Order object
* @return void
*/
function resend_send_admin_order_email( $order ) {
// Send the admin new order email.
WC()->payment_gateways();
WC()->shipping();
WC()->mailer()->emails['WC_Email_New_Order']->trigger( $order->get_id(), $order );
// Note the event.
$order->add_order_note( __( 'Order details manually sent to admin.', 'woocommerce' ), false, true );
do_action( 'woocommerce_after_resend_order_email', $order, 'new_order' );
// Change the post saved message.
add_filter( 'redirect_post_location', array( 'WC_Meta_Box_Order_Actions', 'set_email_sent_message' ) );
}
add_action( 'woocommerce_order_action_send_admin_order_details', 'resend_send_admin_order_email', 10, 1 );

view raw

functions.php

hosted with ❤ by GitHub