put woocommerce orders on pending payment automatically

Solutions on MaxInterview for put woocommerce orders on pending payment automatically by the best coders in the world

showing results for - "put woocommerce orders on pending payment automatically"
Martina
31 Sep 2020
1add_action( 'woocommerce_thankyou', 'woocommerce_thankyou_change_order_status', 10, 1 );
2function woocommerce_thankyou_change_order_status( $order_id ){
3    if( ! $order_id ) return;
4
5    $order = wc_get_order( $order_id );
6
7    if( $order->get_status() == 'processing' )
8        $order->update_status( 'pending' );
9}
10