auto change order status to complete

CHANGE WOOCOMMERCE ORDER STATUS TO COMPLETE

One of my clients recently contacts me as he wants to Change the status of all orders automatically to Completed and trigger email with shipping information to the customer as well on his woocommerce powered online store.

The solution is quite simple.

CHANGE ORDER STATUS TO COMPLETE

All you have to do is use the following code snippet at the end of ‘functions.php’ file

/**
 * Auto Complete all WooCommerce orders.
 */
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 );
    $order->update_status( 'completed' );
}

If you don’t want to mess with code there is an plugin availabile to chnage the order status to Complete automatically.

Warning

If you use Stripe or PayPal sandbox account for testing, you wouldn’t able to get the payment confirmation Jason data by which woocommerce change the order status to processing after completing the payment,

In other words, it will not work if you are using PayPal or Stripe sandbox for testing purposes. But shouldn’t have any problem with normal orders.

If you are having any problem ask me in comments below or shoot me an email.

2 Comments

  1. Hi since I sell package deals containing 2 products, my order won’t auto complete anymore.. Do you have any solution? Thanks in advance!

Leave a Reply

Your email address will not be published. Required fields are marked *