In Woocommerce, when the payment option is COD, the orders go directly to the "Processing" state.
Source: https://docs.woocommerce.com/document/managing-orders/#prettyPhoto
I need this to work like this, except when the client's role is "X".
I have seen that this can be solved with this code:
function cod_payment_method_order_status_to_onhold( $order_id ) {
if ( ! $order_id )
return;
$order = wc_get_order( $order_id );
if ( get_post_meta($order->id, '_payment_method', true) == 'cod' )
$order->update_status( 'on-hold' );
}
add_action( 'woocommerce_thankyou', 'cod_payment_method_order_status_to_onhold', 10, 1 );
However, the problem is that it goes through "Processing", sends the email and then goes to "on hold". I want to avoid sending the "Processing" mail
Any way to do it? Thank you!