Change order status with woocommerce_payment_complete() not working for Paypal

Question

I am using this hook to change the status after the payment is completed. Which it works with other payment method but with Paypal, after the IPN is received, it put it back to completed

/* Change order status to ON HOLD */
add_action( 'woocommerce_payment_complete', 'bravad_change_payment_order_status' );
function bravad_change_payment_order_status( $order_id ) { 
    if ( ! $order_id ) {
        return;
    }

    $order = wc_get_order( $order_id );
    $order->update_status( 'wc-on-hold' );
}

Is there another hook I can choose to make sure to put my order on-hold even after the Paypal’s IPN as been received?

0
Warface 3 months 0 Answers 18 views 0

Leave an answer