This function will prevent the Customers Import from deleting other user roles such as Shop Manager when run with the "Remove users not present in this import file" option.
function is_post_to_delete_on_meta($is_post_to_delete, $pid, $import)
{
// Check if the current user has the 'shop_manager' role
if ( user_can( $pid, 'shop_manager' ) ) {
// If the user is a shop manager, don't delete the record
return false;
}
// If the user is not a shop manager, allow deletion of the record
return true;
}
add_filter('wp_all_import_is_post_to_delete', 'is_post_to_delete_on_meta', 10, 3);