Title: problem with automatically complete orders
Last modified: November 23, 2021

---

# problem with automatically complete orders

 *  Resolved [strigga](https://wordpress.org/support/users/strigga/)
 * (@strigga)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-automatically-complete-orders/)
 * I have implemented following code to set all my orders except bacs to complete
   after ordering:
 *     ```
       add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
       function custom_woocommerce_auto_complete_order( $order_id ) { 
           if ( ! $order_id ) {
               return;
           }
   
           $order = wc_get_order( $order_id );
   
           if($order->get_payment_method() == 'bacs'){
             $order->update_status( 'processing' );
           }else{
             $order->update_status( 'completed' );
           }
       }
       ```
   
 * But at my recent 2 orders (which aren’nt bacs), the status is still “processing”.
   but I can’t figure out why?
    -  This topic was modified 4 years, 6 months ago by [strigga](https://wordpress.org/support/users/strigga/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Ahir Hemant](https://wordpress.org/support/users/hemant-ahir/)
 * (@hemant-ahir)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-automatically-complete-orders/#post-15097118)
 * Hi [@strigga](https://wordpress.org/support/users/strigga/)
 * Try this
 *     ```
       dd_action( 'woocommerce_thankyou', 'bacs_order_payment_processing_order_status', 10, 1 );
   
       function bacs_order_payment_processing_order_status( $order_id ) {
           if ( ! $order_id ) {
               return;
           }
   
           // Get an instance of the WC_Order object
           $order = new WC_Order( $order_id );
   
           if ( ( get_post_meta($order->id, '_payment_method', true) == 'bacs' )) {
               $order->update_status('processing');
           } else {
                $order->update_status('completed');
           }
       }
       ```
   
 * Code goes in function.php file of your active child theme (or active theme). 
   tested and works.
 * Thanks
    Ahir Hemant
 *  Thread Starter [strigga](https://wordpress.org/support/users/strigga/)
 * (@strigga)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-automatically-complete-orders/#post-15097175)
 * My code in the first post works too. At my past orders everything worked, but
   not at the latest 2 orders … and I can’t figure out why.
 *  [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * (@rainfallnixfig)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-automatically-complete-orders/#post-15101643)
 * Hi [@strigga](https://wordpress.org/support/users/strigga/),
 * If the same payment method was setting your orders to “Completed” while now you
   see “Processing” status, it might be due to a recent change on your site, or 
   a conflict after an update.
 * You may want to run conflict testing to check if it’s working with all plugins
   disabled except for WooCommerce and with the default Storefront theme.
 * You will find more details here: You can find a more detailed explanation on 
   how to do a conflict test here: [https://docs.woocommerce.com/document/how-to-test-for-conflicts/](https://docs.woocommerce.com/document/how-to-test-for-conflicts/).
 * Thanks.
 *  [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * (@rainfallnixfig)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-automatically-complete-orders/#post-15123697)
 * Hi there,
 * We haven’t heard from you in a while, so I’m going to mark this as resolved. 
   Feel free to start a new thread if you have any more questions.
 *  Thread Starter [strigga](https://wordpress.org/support/users/strigga/)
 * (@strigga)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-automatically-complete-orders/#post-15124826)
 * I can’t say why, but it only happened once and at the next order it worked again.
   I also sometimes get the order email 3 times … maybe a server problem?
 *  [Margaret S. woo-hc](https://wordpress.org/support/users/margaretwporg/)
 * (@margaretwporg)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-automatically-complete-orders/#post-15125111)
 * Hi [@strigga](https://wordpress.org/support/users/strigga/)
 * It could be. If the problem does not recur, well and good. Or else please open
   up a new thread and we’ll be happy to help out.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘problem with automatically complete orders’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 6 replies
 * 4 participants
 * Last reply from: [Margaret S. woo-hc](https://wordpress.org/support/users/margaretwporg/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/problem-with-automatically-complete-orders/#post-15125111)
 * Status: resolved