Create orders as ‘auto-draft’ instead of ‘pending’ in the admin

This commit is contained in:
Jorge A. Torres 2023-04-10 14:13:00 -05:00
parent 2c626fe854
commit 9d60bf90ed
1 changed files with 6 additions and 1 deletions

View File

@ -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;
}