Skip to content

Instantly share code, notes, and snippets.

@ofernandolopes
Forked from woogist/functions.php
Created October 16, 2017 07:16
Show Gist options
  • Save ofernandolopes/9b6108590b6b97f3119ff933ae6ba894 to your computer and use it in GitHub Desktop.
Save ofernandolopes/9b6108590b6b97f3119ff933ae6ba894 to your computer and use it in GitHub Desktop.
Autocomplete all WooCommerce orders
/**
* Auto Complete all WooCommerce orders.
*/
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) {
if ( ! $order_id ) {
return;
}
$order = wc_get_order( $order_id );
$order->update_status( 'completed' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment