1

I want to change the default status the built in PayPal gateway in WooCommerce . Currently, when a new order is created, it's updating to 'processing'. I want to change it but I can't see anywhere to change it, not in the WooCommerce -> Payments settings and not in the code (probably I just missed it).

Does anyone knows where it is?

Thanks.

8
  • please check the link i hope solve your problem : angelleye.com/… Commented Dec 24, 2018 at 10:40
  • As I understands it talks about the PayPal integration. I am using the WooCommerce Built-in PayPal gateway, will it still work?
    – Omer
    Commented Dec 24, 2018 at 10:43
  • not clear your question for me please explain to me i help you Commented Dec 24, 2018 at 10:59
  • I am using the PayPal gateway that comes with WooCommerce. Apparently it's called PayPal Standard.
    – Omer
    Commented Dec 24, 2018 at 11:04
  • I'm not sure I understand you. Currently, when an order is created through the PayPal gateway, the new order status will be processing. I want to change it so it will be set to a custom status I have created.
    – Omer
    Commented Dec 24, 2018 at 11:08

1 Answer 1

1
add_action( 'woocommerce_thankyou', 'change_order_status', 10, 1 );
function change_order_status( $order_id ){
     if( ! $order_id ) return;
     $order = wc_get_order( $order_id );
     if( $order->get_status() == 'processing' )
     $order->update_status( 'pending' );
}
1
  • 1
    I tried to look for the function which changes the order status in order to edit it but did not find it... hence the question, how can I make the PayPal gateway change the order status to a custom status instead of 'processing'? Commented Dec 24, 2018 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.