Autocomplete WooCommerce Orders

Written by
Typical Read
0 minutes

Learn how to autocomplete WooCommerce orders after a customer completes the checkout process using the woocommerce_thankyou hook.


 * Auto-completes a WooCommerce order.
 * @since x.x.x
 * @link
 * @param int $order_id The order ID of the processed order.
add_action( 'woocommerce_thankyou', 'yourplugin_woocommerce_auto_complete_order' );
function yourplugin_woocommerce_auto_complete_order( $order_id ) {
  if ( ! $order_id ) { return; }
  $order = wc_get_order( $order_id );
  $order->update_status( 'completed' );

You could also change the “Completed” status to be another order status, like “Processing”.

Join the conversation.

Your email address will not be published. Required fields are marked *

All comments posted on 'Autocomplete WooCommerce Orders' are held for moderation and only published when on topic and not rude. Get a gold star if you actually read & follow these rules.

You may write comments in Markdown. This is the best way to post any code, inline like `<div>this</div>` or multiline blocks within triple backtick fences (```) with double new lines before and after.

Want to tell me something privately, like pointing out a typo or stuff like that? Contact Me.