$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Change WooCommerce PayPal Built-in Default Order Status|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Change WooCommerce PayPal Built-in Default Order Status

matteradmin9PV0评论

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.

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.

Share Improve this question edited Dec 26, 2018 at 8:07 butlerblog 5,1413 gold badges28 silver badges44 bronze badges asked Dec 24, 2018 at 10:38 OmerOmer 1491 gold badge4 silver badges14 bronze badges 8
  • please check the link i hope solve your problem : angelleye/… – vikrant zilpe 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 – vikrant zilpe 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
 |  Show 3 more comments

1 Answer 1

Reset to default 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' );
}
Post a comment

comment list (0)

  1. No comments so far