From 4b0416d25165c47e356d7292ca6885b70f7f19c2 Mon Sep 17 00:00:00 2001 From: Jorge Torres Date: Fri, 11 Aug 2023 14:56:38 -0300 Subject: [PATCH] =?UTF-8?q?Do=20not=20fire=20=E2=80=98woocommerce=5Fnew=5F?= =?UTF-8?q?order=E2=80=99=20when=20creating=20auto-draft=20orders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Internal/DataStores/Orders/OrdersTableDataStore.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php b/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php index d5868b7025b..ee4563298a3 100644 --- a/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php +++ b/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php @@ -2276,6 +2276,11 @@ FROM $order_meta_table $this->persist_save( $order ); + // Do not fire 'woocommerce_new_order' for draft statuses for backwards compatibility. + if ( 'auto-draft' === $order->get_status( 'edit') ) { + return; + } + /** * Fires when a new order is created. *