<?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 );