Set proper default when creating orders

This commit is contained in:
mattallan 2024-09-17 12:30:01 +10:00
parent 0036b4d293
commit 7774da6bc2
2 changed files with 3 additions and 0 deletions

View File

@ -76,6 +76,8 @@ abstract class Abstract_WC_Order_Data_Store_CPT extends WC_Data_Store_WP impleme
public function create( &$order ) { public function create( &$order ) {
$order->set_version( Constants::get_constant( 'WC_VERSION' ) ); $order->set_version( Constants::get_constant( 'WC_VERSION' ) );
$order->set_currency( $order->get_currency() ? $order->get_currency() : get_woocommerce_currency() ); $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' ) ) { if ( ! $order->get_date_created( 'edit' ) ) {
$order->set_date_created( time() ); $order->set_date_created( time() );
} }

View File

@ -2555,6 +2555,7 @@ FROM $order_meta_table
protected function persist_save( &$order, bool $force_all_fields = false, $backfill = true ) { protected function persist_save( &$order, bool $force_all_fields = false, $backfill = true ) {
$order->set_version( Constants::get_constant( 'WC_VERSION' ) ); $order->set_version( Constants::get_constant( 'WC_VERSION' ) );
$order->set_currency( $order->get_currency() ? $order->get_currency() : get_woocommerce_currency() ); $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' ) ) { if ( ! $order->get_date_created( 'edit' ) ) {
$order->set_date_created( time() ); $order->set_date_created( time() );