Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[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' );
}
@liakatsagoni

This comment has been minimized.

Copy link

commented May 12, 2018

Does this work if a place it in a CodeSnippet plug in???

@lnorton89

This comment has been minimized.

Copy link

commented May 14, 2018

I've noticed this works intermittently, not sure the cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.