From 7774da6bc2aca8ad7cbd9130afa8324d436ed64b Mon Sep 17 00:00:00 2001 From: mattallan Date: Tue, 17 Sep 2024 12:30:01 +1000 Subject: [PATCH] Set proper default when creating orders --- .../includes/data-stores/abstract-wc-order-data-store-cpt.php | 2 ++ .../src/Internal/DataStores/Orders/OrdersTableDataStore.php | 1 + 2 files changed, 3 insertions(+) diff --git a/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php b/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php index c3d5a36f2e9..427a7c12f90 100644 --- a/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php +++ b/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php @@ -76,6 +76,8 @@ abstract class Abstract_WC_Order_Data_Store_CPT extends WC_Data_Store_WP impleme public function create( &$order ) { $order->set_version( Constants::get_constant( 'WC_VERSION' ) ); $order->set_currency( $order->get_currency() ? $order->get_currency() : get_woocommerce_currency() ); + $order->set_prices_include_tax( 'yes' === get_option( 'woocommerce_prices_include_tax' ) ); + if ( ! $order->get_date_created( 'edit' ) ) { $order->set_date_created( time() ); } diff --git a/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php b/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php index 9602bd4f6b7..1a2604c8c60 100644 --- a/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php +++ b/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php @@ -2555,6 +2555,7 @@ FROM $order_meta_table protected function persist_save( &$order, bool $force_all_fields = false, $backfill = true ) { $order->set_version( Constants::get_constant( 'WC_VERSION' ) ); $order->set_currency( $order->get_currency() ? $order->get_currency() : get_woocommerce_currency() ); + $order->set_prices_include_tax( 'yes' === get_option( 'woocommerce_prices_include_tax' ) ); if ( ! $order->get_date_created( 'edit' ) ) { $order->set_date_created( time() );