Enter your keyword

Blog

How to automatically complete orders in WooCommerce

Automatically mark orders for virtual products as Completed after a successful payment by adding this snippet into your functions.php:

/**
* Auto Complete all WooCommerce orders.
* Add to theme functions.php file
*/

add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) {
    global $woocommerce;
    if ( !$order_id )
        return;
    $order = new WC_Order( $order_id );
    $order->update_status( 'completed' );
}

No Comments

Add your review

Your email address will not be published.

* Feilds are Required.