Last active
April 6, 2020 01:25
-
-
Save the-sufi/6f0f68fcf8efd70b33dbb23481aeda31 to your computer and use it in GitHub Desktop.
WooCommerce - Automactically Mark Orders as Complete
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
<?php | |
/** | |
* Auto Complete all WooCommerce orders. | |
*/ | |
function dctit_custom_woocommerce_auto_complete_order( $order_id ) { | |
if ( ! $order_id ) { | |
return; | |
} | |
$order = wc_get_order( $order_id ); | |
$order->update_status( 'completed' ); | |
} | |
add_action( 'woocommerce_thankyou', 'dctit_custom_woocommerce_auto_complete_order' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment