/* Order Status 'On Hold' for COD */
add_filter( 'woocommerce_cod_process_payment_order_status', 'wpflt_cod_order_status_hold', 10, 2 );
function wpflt_cod_order_status_hold( $order_status, $order ) {
return 'wc-on-hold';
}
When customers place orders, by default, WooCommerce changes the status of the order to ‘processing‘. However, when customers purchase through Cash on Delivery, orders can be spammy or may not be genuine. Or, the customer has casually placed the order to see what happens ( Yes! some folks do this).
In such cases, shop owners want to remove such orders from the list. So, it is better to change the status of COD order to ‘On Hold‘ instead of Processing, immediately when the COD order is placed.
If the status of COD orders are automatically updated to processing, it sends Emails to the customers regarding the status. Cancelling the order once the processing E-mail has been sent, is not the right thing to do for any brand.