Support » Fixing WordPress » Change order status from on-hold to processing – code needed

  • Sandy Rao

    (@sandyrao)


    Hi,
    I don’t need a plug-in. Instead I’d like to have the order status showing as processing instead of on-hold for all orders placed. Is there any code I can change?

    Thanks in advance!
    Sandy

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Vlad T

    (@vladytimy)

    Hi, @sandyrao

    I recommend asking at https://wordpress.org/support/plugin/woocommerce/ so the plugin’s developers and support community can help you with this.

    Kind regards!

    Thread Starter Sandy Rao

    (@sandyrao)

    Thanks, @vladytimy

    LitExtension_Lucas

    (@lucaslitextension)

    Hi,

    You can add this code to the function.php of the active theme/child theme:

    add_action( 'woocommerce_thankyou', 'woocommerce_auto_processing_orders');
    function woocommerce_auto_processing_orders( $order_id ) {
    if ( ! $order_id )
    return;
    $order = wc_get_order( $order_id );
    // If order is "on-hold" update status to "processing"
    if( $order->has_status( 'on-hold' ) ) {
    $order->update_status( 'processing' );
    }
    }

    Hope this helps 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.