Automatically Complete Orders in WooCommerce

Auto Complete all WooCommerce orders, add this code to theme’s 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 ) {
    global $woocommerce;
 
    if ( !$order_id )
        return;
    $order = new WC_Order( $order_id );
    $order->update_status( 'completed' );
}