Skip to content

Instantly share code, notes, and snippets.

@Acephalia
Created August 19, 2024 01:13
Show Gist options
  • Save Acephalia/174dc4dfe767349142dc2eb6b025b720 to your computer and use it in GitHub Desktop.
Save Acephalia/174dc4dfe767349142dc2eb6b025b720 to your computer and use it in GitHub Desktop.
Resend WooCommerce New Order Notification On Processing
/*
* @snippet Resend WooCommerce new order notification to admin when order status changes to processing
* @author https://gist.github.com/Acephalia
* @caffeinate https://buymeacoffee.com/acephaliax
*/
// Allow resending of New Order emails
add_filter('woocommerce_new_order_email_allows_resend', '__return_true');
// Resend New Order notification when order status changes to processing
add_action('woocommerce_order_status_processing', 'resend_new_order_notification_to_admins', 10, 1);
function resend_new_order_notification_to_admins($order_id) {
if (!$order_id) {
return;
}
// Get the WC_Email_New_Order object
$email_new_order = WC()->mailer()->get_emails()['WC_Email_New_Order'];
// Send the New Order email notification for the $order_id
$email_new_order->trigger($order_id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment