Skip to content

Instantly share code, notes, and snippets.

@eagleyed
Created August 7, 2020 10:58
Show Gist options
  • Save eagleyed/01e1239bf1dd400874e2039f8385b4bb to your computer and use it in GitHub Desktop.
Save eagleyed/01e1239bf1dd400874e2039f8385b4bb to your computer and use it in GitHub Desktop.
[Frontend Snippets] Automatically complete all 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