I need to disable email notifications for particular order ID. For example in woocommerce order id 2378 then i want to disable all email notification for customer only for this order ID. Because i continue to have issues where an order changes statuses by itself. This has been an ongoing issue for us and unfortunately, i haven’t been able to find the cause.However, there has been one particular order that keeps changing statuses ever since it was first placed way back in September.
I found some code for disabling email notification below is that code.But i don't know how to use that function with particular order ID.
add_action( 'woocommerce_email', 'unhook_those_pesky_emails' );
function unhook_those_pesky_emails( $email_class ) {
remove_action( 'woocommerce_order_status_completed_notification', array( $email_class->emails['WC_Email_Customer_Completed_Order'], 'trigger' ) ); // cancels automatic email of order complete status update.
remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) ); // cancels automatic email of new order placed (when defined to procession status)
remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) ); // cancels automatic email of status update to processing.
}