How to Auto Complete WooCommerce Orders

Webdesign Tips & Tricks

I recently was creating a website to sell tickets to an event. We waned people to automatically get a confirmation ticket as soon as they paid.

However, by default WooCommerce is built for physical products that need to be manually fulfilled by the seller. As a result, all orders are marked as “Pending”, and it’s up to you to switch their status to in-progress or completed based on your delivery.

(When a product is both virtual and downloadable, WooCommerce does mark it as complete, but in this case it was virtual but NOT downloadable. People got tickets in their email.)

For that, I found this simple code in the WooCommerece documentation, to automatically mark all orders as complete.

 * 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 ) {

    $order = wc_get_order( $order_id );
    $order->update_status( 'completed' );

The code above should be added to your functions.php file in a child theme, to prevent it from being overritted by a theme update.

If you need more advanced control, such as marking only virtual products as completed while leaving physical products as pending, there’s a plugin you can buy for that.

By the way, for my ticketing platform I used YITH’s WooCommerece event tickets plugin, which give you a lot of customization for selling access to physical and virtual events.

Other Projects