Knowledge Base

Help, guides and FAQ about Magikcommerce.

How to Automatically Mark Orders as ‘Complete’ in WooCommerce?

WooCommerce allows the order to go from ‘Pending’, to ‘Processing’, and finally to ‘Completed’ once the products have been sent out.

Automatically mark orders as ‘complete’ in WooCommerce

Add the following lines of code in your theme's functions.php file

add_action( 'woocommerce_thankyou', 'magik_woocommerce_auto_complete_order' );
function magik_woocommerce_auto_complete_order( $order_id ) 
{ 
    if ( ! $order_id ) {
        return;
    }

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

 

If you face any problems or need our professional services, please email us at [email protected].