Force WooCommerce Orders To Auto Complete

WooCommerce

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.

Menu
Google Rating
5.0
Get a Quote