I need to get customer group for each customer in my site. I can get customer group list as below,
$customerGroupsCollection = $objectManager>get('\Magento\Customer\Model\ResourceModel\Group\Collection');
$customerGroups = $customerGroupsCollection->toOptionArray();
foreach ($customerGroups as $key => $value) {
//print_r($value);
echo $value['label'];
}
How can I filter this by customer Id? I cannot use CustomerSession to get customer information since I need to retrieve each and every customer's data whenever needed.
I got customer data as follows,
$customer = $objectManager->create('Magento\Customer\Model\Customer')->getCollection();
foreach ($customer as $cusitem) {
$customerId = $cusitem->getData('entity_id');
}
How can I combine these two and get customer group for each customer?
Ex:
Have 10 customers(1-10), and have 3 customer groups (A,B,C). How to get each customer's group name?
if customer is 1, How to get 1's group?