nevercrox.com

WooCommerce Automatically Set On-Hold Order Status To Processing

Pre-Requisites

There are no pre-requisites for this code snippet to work. Keep in mind this solution consists of two code snippets, one to display the content and one to style it.

How To Implement This Solution?

Add these two code snippets as separate entries in either your active child theme’s functions.php file or the Code Snippets plugin.

About The Snippet

If you want to bypass the on-hold order status automatically set by WooCommerce or the payment gateway and change it to Processing instead, this guide is for you. Typically, store owners don’t use the Order on-hold email; they prefer the Processing or Completed order emails. Since it’s uncommon for customers to get notifications about their order being on hold, this solution ensures that orders are set to Processing right away.

Code Snippet 1 (Paste This Code In functions.php or Code Snippets )
/**
* Snippet Name:     Automatically update the On-hold order status to show Processing instead.
* Snippet Author:   Nevercrox Solutions
*/

function nevercrox_auto_update_order_status( $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', 'nevercrox_auto_update_order_status' );


 

Just Added Blogs

Need A Specifc Blog ?

Request A Blog

Check Out More Related Snippets

0
Would love your thoughts, please comment.x
()
x