If you’d like to bypass the on-hold order status which either WooCommerce or the payment gateway the customer uses automatically sets on orders, and make it the Processing order status instead, then this guide is for you. Typically, store owners wont have the Order on-hold email active. Instead, they will have the Processing order or Completed order. It’s not usual that customers receive an email to tell them their order is on hold, so this solution resolves that.
Code Solution
/**
* Snippet Name: Automatically update the On-hold order status to show Processing instead..
* Snippet Author: ecommercehints.com
*/
function custom_woocommerce_auto_complete_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_complete_order' );