I need to set all WooCommerce orders that come in as "on-hold" to "processing" and also have the order-processing email sent out immediately.
I tried this
function custom_woocommerce_auto_order( $order_id ) {
if ( ! $order_id ) {
return;
}
$order = wc_get_order( $order_id );
if( 'on-hold'== $order->get_status() ) {
$order->update_status( 'processing' );
}
}
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_order' );
Although the status changes, the "on-hold" email notification will still be sent even though it should only be the "processing" email notification.
Any advice?