Support » Plugin: WooCommerce » change default order status from on-hold to processing

  • Resolved Sandy Rao

    (@sandyrao)


    Hi,
    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?

    P.S. I don’t want to install a plugin for this.

    Thanks in advance!
    Sandy

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support maykato

    (@maykato)

    Hello,

    You can add custom code like this (https://gist.github.com/woogists/3e466c8ada98e0e7c9158678d44758a3) to your child theme’s functions.php – change “completed” to “processing” to auto change all WooCommerce orders to processing.

    I hope it helps.

    Thread Starter Sandy Rao

    (@sandyrao)

    Hi Mayko,
    I added this code:

    /* Change Default Order Status from On-HOld for Purchase Orders to Processing */
    add_action( 'woocommerce_order_status_changed', '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' );
        }
    }

    And it is working. The order in the admin area changes to Processing. Thumbs up!

    However, the customer gets two emails… one for on-hold invoice and the other for processing invoice, back to back.
    I prefer there be only one “Your Order is being Processed” invoice sent to customers. How do I accomplish that?

    Thanks.

    Thread Starter Sandy Rao

    (@sandyrao)

    Sorry I got your name incorrect. Pardon me, @maykato

    Thread Starter Sandy Rao

    (@sandyrao)

    Just an FYI, I also changed in the PDF Invoices setting to send invoice for Processing status only. Still during testing I got two invoices for order placed.

    Plugin Support Tseten D a11n

    (@tibetanitech)

    Hi @sandyrao

    I’m glad the custom code snippet worked for you. You can disable the email for orders on-hold from WooCommerce > Settings > Emails. Please note that this will disable all the emails for the order status that are on-hold.

    https://d.pr/i/evl5MM
    Link to image: https://d.pr/i/evl5MM

    Thread Starter Sandy Rao

    (@sandyrao)

    That worked. Thanks a lot.

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