|

autocomplete WooCommerce orders

To make woocommerce product orders autocomplete you can use this code

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

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *