Viewing 4 replies - 1 through 4 (of 4 total)
  • Same for me. Waiting for the solution…

    function set_default_order( $order_id ){
    global $woocommerce;
    if ( !$order_id ) return;
    $order = new WC_Order( $order_id );
    $ar = get_term_by( ‘id’, $termid, ‘shop_order_status’); // pass here term id of the pending status.
    $order->update_status($ar->slug);
    }
    add_action( ‘woocommerce_thankyou’, ‘set_default_order’ );

    @anandsofg

    Could you explain your code above. I don’t see how this changes the default order status. Better yet, just post an example of changing the order status from “on-hold” to “processing”. Thanks for your help,

    I found this code. Put it in your theme’s functions.php:

    This will change the status of all new orders to “processing”. You can change that status to any other. Note: this auto updates all order status’ on new order, so if you are using multiple payment methods, you might not want to use this as it might screw up your defaults on other payment methods. I’m only using cheque, so I want all new orders to enter as “processing” instead of “on-hold.”

    /* Reset status of new orders from "on-hold" to "processing" */
    add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
    function custom_woocommerce_auto_complete_order( $order_id ) {
        global $woocommerce;
         if ( !$order_id )
            return;
        $order = new WC_Order( $order_id );
        $order->update_status( 'processing' );
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Woocommerce How to change default order status for cash on delivery payment gate’ is closed to new replies.