WooCommerce – Autocomplete all Orders

What if you just want to automatically complete all of the orders that come in?
The following code snippet will do just that (with WooCommerce 2.2+):

/**
* Autocomplete all WooCommerce orders (2.2+)
* Add to theme functions.php file
*/
 
add_action( 'woocommerce_thankyou', 'wc_autocomplete_order' );
function wc_autocomplete_order( $order_id ) {
	
	// Only continue if have $order_id
	if ( ! $order_id ) {
		return;
	}
    
    	// Get order
    	$order = wc_get_order( $order_id );
    	
    	// Update order to completed status
    	$order->update_status( 'completed' );
    	
}
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 3.00 out of 5)
Loading...Loading...
Oopps, sorry. This discussion is closed.

If you are a paying customer and you are looking for Tech Support please post a ticket on our Support Tickets page and we will respond promptly.

If you are not a paying customer and you would like to post a pre-sale question or a quote request please use our Contact form.

Why did we close the discussion?

Many of the customers started reporting issues as comments instead of the ticketing system and this started delaying our response time.

We are making this change to serve our customers better. We have ramped up our support team and we are trying to get the reply out on the same day.

Thanks for understanding.

moonsung@mailxu.com connington141@mailxu.com