diff --git a/includes/class-siti-stock-supplier-exports.php b/includes/class-siti-stock-supplier-exports.php index 0ee5671..36ba1c7 100644 --- a/includes/class-siti-stock-supplier-exports.php +++ b/includes/class-siti-stock-supplier-exports.php @@ -307,16 +307,18 @@ class Siti_Stock_Supplier_Exports { private function collect_rows_for_supplier( $supplier ) { $key = $this->normalize_supplier_key( $supplier ); - $after_timestamp = current_time( 'timestamp' ) - DAY_IN_SECONDS; - $date_filter = array( - 'after' => gmdate( 'Y-m-d H:i:s', $after_timestamp ), - ); + $site_timezone = function_exists( 'wp_timezone' ) ? wp_timezone() : new DateTimeZone( wp_timezone_string() ); + $after_date = new DateTimeImmutable( 'now', $site_timezone ); + $after_date = $after_date->sub( new DateInterval( 'P1D' ) ); + $after_utc = $after_date->setTimezone( new DateTimeZone( 'UTC' ) ); - if ( class_exists( 'WC_DateTime' ) ) { - $after_object = new WC_DateTime( '@' . $after_timestamp ); - $after_object->setTimezone( new DateTimeZone( 'UTC' ) ); - $date_filter = array( 'after' => $after_object ); - } + $date_query = array( + array( + 'column' => 'date_created_gmt', + 'after' => $after_utc->format( 'Y-m-d H:i:s' ), + 'inclusive' => true, + ), + ); $query = new WC_Order_Query( array( @@ -324,7 +326,7 @@ class Siti_Stock_Supplier_Exports { 'limit' => -1, 'type' => 'shop_order', 'return' => 'objects', - 'date_created' => $date_filter, + 'date_query' => $date_query, ) ); diff --git a/siti-stock-plugin.php b/siti-stock-plugin.php index 7465f0d..6f3a5a2 100644 --- a/siti-stock-plugin.php +++ b/siti-stock-plugin.php @@ -3,7 +3,7 @@ * Plugin Name: Siti Stock Plugin * Plugin URI: https://github.com/SitiWeb/siti-stock-plugin * Description: Synchroniseert WooCommerce voorraad met het externe Siti voorraadplatform. - * Version: 1.2.3 + * Version: 1.2.4 * Author: Siti Web * Author URI: https://www.siti.nl * Requires PHP: 8.1 @@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } -define( 'SITI_STOCK_PLUGIN_VERSION', '1.2.3' ); +define( 'SITI_STOCK_PLUGIN_VERSION', '1.2.4' ); define( 'SITI_STOCK_PLUGIN_FILE', __FILE__ ); define( 'SITI_STOCK_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );