Last active
August 29, 2015 14:19
-
-
Save nickkuijpers/84d4a93c363ac5c5f2d0 to your computer and use it in GitHub Desktop.
WooCommerce Auto Complete Orders After Payment Received
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Auto Complete all WooCommerce orders. | |
* Add to theme functions.php file | |
*/ | |
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order', 1, 1 ); | |
function custom_woocommerce_auto_complete_order( $order_id ) { | |
global $woocommerce; | |
if ( !$order_id ) | |
return; | |
$order = new WC_Order( $order_id ); | |
if( $order->post->post_status == 'wc-processing' ){ | |
$order->update_status( 'completed' ); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment