Please, add this code snippet to the bottom of functions.php file of your theme. You can do this via WP Admin > Appearance menu > Theme Editor > and by picking “Theme Functions” (functions.php) on the right.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | function gb_complete_order( $order_id ) { $order = wc_get_order( $order_id ); if( !empty( $order ) ) { // $payment_method = $order->get_payment_method(); $order_status = $order->get_status(); if( $order_status == 'processing' ) { $order->update_status( 'completed' ); } } } add_action( 'woocommerce_order_status_processing', 'gb_complete_order', 1 ); |