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' );
    	
}