This is a snippet code (that you can find in wooCommerce docs):
/**
* 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' );
}
But this snippet does not work for "BACS", "Pay on delivery" and "Cheque" payment methods. It's ok for Paypal and Credit Card gateways payment methods.
There is also a wordpress (woocommerce) free plugin working with all payment methods except some others Credit Card gateways payment methods:
Auto complete paid Orders (depending on Payment methods)
WooThemes - WooCommerce Autocomplete Orders
Regards