Magento 2 Customer Groups

👥 Magento 2 Customer Groups – Segment Your Shoppers Smartly

Customer Groups in Magento 2 allow you to categorize your customers into segments like General, Wholesale, or Not Logged In. This helps you offer personalized pricing, tax rules, or discounts based on the group a customer belongs to.

🎯 Default Customer Groups

  • NOT LOGGED IN – For guests and anonymous visitors
  • General – Standard retail customers
  • Wholesale – B2B customers with bulk pricing
  • Retailer – Often used for dealers or resellers

🧭 Where to Find Customer Groups

In the admin panel, go to: Customers > Customer Groups

➕ Create a New Customer Group

You can create a custom group and assign tax classes or special rules.

// Create a customer group programmatically
$groupFactory = \Magento\Customer\Model\GroupFactory::create();
$group = $groupFactory->create();
$group->setCode('VIP Customers')
      ->setTaxClassId(3) // Example Tax Class ID
      ->save();

Try It Now

👤 Assign Customer to a Group

You can assign a customer to a group manually or via script.

// Assign customer to a different group
$customer = $this->customerRepository->getById(123); // Customer ID
$customer->setGroupId(4); // Group ID for 'VIP Customers'
$this->customerRepository->save($customer);

Try It Now

💡 Use Cases of Customer Groups

  • Show different prices for B2B vs. retail customers
  • Apply specific tax classes to certain groups
  • Target promotions using group-based conditions
  • Restrict access to certain products or CMS pages

✅ Summary

  • Customer groups help segment your shoppers for better targeting
  • They can be created and managed easily via admin or programmatically
  • You can use groups for pricing, taxes, promotions, and access control

Grouping your customers smartly leads to better conversions and personalized experiences in your Magento 2 store!