In WooCommerce, I need all my orders to go immediately to "processing" status to have the order-processing email sent directly when the order is processed.
By default, this behavior exist for Paypal and COD orders, but not for BACS and Cheque where the default status is on-hold
.
I tried several snippets like this one:
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_process_order' );
function custom_woocommerce_auto_process_order( $order_id ) {
if ( ! $order_id ) {
return;
}
$order = wc_get_order( $order_id );
$order->update_status( 'processing' );
}
But this doesn't work, the order still shows up in "on-hold" status and the processing email notification is not sent. Now I just found a this snippet:
add_filter( 'woocommerce_bacs_process_payment_order_status', function( $status = 'on_hold', $order = null ) {
return 'processing';
}, 10, 2 );
And it works, but only for "BACS". How can I adapt it to also work for "Cheque" orders?