WooCommerce – Autocomplete all Orders
December 8, 2015 in Code Snippets by
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' ); }

About Milan
The founder of Dessky, Milan has worked in all aspects of advanced web development, from building large commercialized e-commerce and social network systems to troubleshooting small wordpress blogs. His extensive skills cover virtually every area of web development. Milan works hard to implement tomorrow’s trends utilizing the cutting edge systems of today. He specializes in rich internet web application development and deployment, complex HTML5/CSS3 graphical design layouts, full blown framework-driven rich internet applications, and much more. Milan provides elegant solutions to complex problems encountered by businesses that use internet based services. Also he is the Graduated Engineer of both Computer Science and Information Technology.