WooCommerce Auto complete orders

On of my clients requirement was that he want all orders automatically completed. So googled little bit and bingo finally found the code I want. Here it is. Thought might be helpful to someone else.

Add following code in your theme’s functions.php file