From 9d60bf90ed4277238b9049765bee41c3817a4af2 Mon Sep 17 00:00:00 2001 From: "Jorge A. Torres" Date: Mon, 10 Apr 2023 14:13:00 -0500 Subject: [PATCH] =?UTF-8?q?Create=20orders=20as=20=E2=80=98auto-draft?= =?UTF-8?q?=E2=80=99=20instead=20of=20=E2=80=98pending=E2=80=99=20in=20the?= =?UTF-8?q?=20admin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Internal/Admin/Orders/PageController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php b/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php index b2e93628844..7f6109a2dbd 100644 --- a/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php +++ b/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php @@ -286,9 +286,14 @@ class PageController { $this->order = new $order_class_name(); $this->order->set_object_read( false ); - $this->order->set_status( 'pending' ); + $this->order->set_status( 'auto-draft' ); $this->order->save(); + // Schedule auto-draft cleanup. We re-use the WP event here on purpose. + if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) { + wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); + } + $theorder = $this->order; }