Woocommerce How to change default order status for cash on delivery payment gate (5 posts)

  1. manuelrossoni
    Posted 2 years ago #

    Hi all,

    if you pay an order with cash on delivery (payment gateway cod), woocommerce set the order as "on-hold" status.
    I need to set the status for new orders as "pending".

    Anyone can help me?

    Thanks in advance.


  2. ADvi
    Posted 2 years ago #

    Same for me. Waiting for the solution...

  3. AnandSOFG
    Posted 2 years ago #

    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.
    add_action( 'woocommerce_thankyou', 'set_default_order' );

  4. ramedia
    Posted 2 years ago #


    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,

  5. ramedia
    Posted 2 years ago #

    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 )
        $order = new WC_Order( $order_id );
        $order->update_status( 'processing' );

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic