diff --git a/plugins/woocommerce/changelog/fix-delete_db_issue b/plugins/woocommerce/changelog/fix-delete_db_issue new file mode 100644 index 00000000000..8e6d1a371c6 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-delete_db_issue @@ -0,0 +1,5 @@ +Significance: patch +Type: fix +Comment: Partial rollback of an earlier PR. + + diff --git a/plugins/woocommerce/src/Internal/DataStores/Orders/DataSynchronizer.php b/plugins/woocommerce/src/Internal/DataStores/Orders/DataSynchronizer.php index 770d232dfeb..c559b251703 100644 --- a/plugins/woocommerce/src/Internal/DataStores/Orders/DataSynchronizer.php +++ b/plugins/woocommerce/src/Internal/DataStores/Orders/DataSynchronizer.php @@ -667,10 +667,12 @@ ORDER BY orders.id ASC return; } + if ( ! $this->get_table_exists() ) { + return; + } + if ( $this->data_sync_is_enabled() ) { - if ( $this->get_table_exists() ) { - $this->data_store->delete_order_data_from_custom_order_tables( $postid ); - } + $this->data_store->delete_order_data_from_custom_order_tables( $postid ); } elseif ( $this->custom_orders_table_is_authoritative() ) { return; }