Fix 'skip_existing' option making not all data not to be imported

This commit is contained in:
Albert Juhé Lluveras 2019-06-10 12:45:01 +02:00
parent 8ed63c5547
commit 5a732d565a
1 changed files with 2 additions and 0 deletions

View File

@ -342,6 +342,7 @@ class WC_Admin_Reports_Sync {
} }
if ( $skip_existing ) { if ( $skip_existing ) {
$offset = 0;
$where_clause .= " AND NOT EXISTS ( $where_clause .= " AND NOT EXISTS (
SELECT 1 FROM {$wpdb->prefix}wc_order_stats SELECT 1 FROM {$wpdb->prefix}wc_order_stats
WHERE {$wpdb->prefix}wc_order_stats.order_id = {$wpdb->posts}.ID WHERE {$wpdb->prefix}wc_order_stats.order_id = {$wpdb->posts}.ID
@ -571,6 +572,7 @@ class WC_Admin_Reports_Sync {
} }
if ( $skip_existing ) { if ( $skip_existing ) {
$query_args['paged'] = 1;
add_action( 'pre_user_query', array( __CLASS__, 'exclude_existing_customers_from_query' ) ); add_action( 'pre_user_query', array( __CLASS__, 'exclude_existing_customers_from_query' ) );
} }