WooCommerce

Force WooCommerce Orders To Auto Complete

There are certain instances when a store owner wants orders to be automatically approved.

We’ve had to use this membership site (to auto enroll people in an online course) before and FooEvents (to automatically send people their tickets):

/**
 * 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' );
}

For more info, head to this website, specifically focused on WooCommerce: docs.woocommerce.com/document/automatically-complete-orders.

See our featured website design work

Check out some of the beautiful websites we’ve built for over 2,000 clients.

We offer WordPress support & maintenance

Shake the stress of ongoing maintenance with plans supported by our team of WordPress experts.

Related articles

Menu