restrict customer import to customer role with filter

This commit is contained in:
Ron Rennick 2019-05-13 13:47:16 -03:00
parent 38c40430ef
commit 28b10f2eb6
1 changed files with 11 additions and 7 deletions

View File

@ -589,12 +589,14 @@ class WC_Admin_Reports_Sync {
*/
public static function customer_lookup_import_batch_init( $days, $skip_existing ) {
$batch_size = self::get_batch_size( self::CUSTOMERS_IMPORT_BATCH_ACTION );
$customer_roles = apply_filters( 'woocommerce_admin_import_customer_roles', array( 'customer' ) );
$customer_query = self::get_user_ids_for_batch(
$days,
$skip_existing,
array(
'fields' => 'ID',
'number' => 1,
'role__in' => $customer_roles,
)
);
$total_customers = $customer_query->get_total();
@ -618,6 +620,7 @@ class WC_Admin_Reports_Sync {
*/
public static function customer_lookup_import_batch( $batch_number, $days, $skip_existing ) {
$batch_size = self::get_batch_size( self::CUSTOMERS_IMPORT_BATCH_ACTION );
$customer_roles = apply_filters( 'woocommerce_admin_import_customer_roles', array( 'customer' ) );
$customer_query = self::get_user_ids_for_batch(
$days,
$skip_existing,
@ -627,6 +630,7 @@ class WC_Admin_Reports_Sync {
'order' => 'ASC',
'number' => $batch_size,
'paged' => $batch_number,
'role__in' => $customer_roles,
)
);