• Magento tutorial completed series for beginners and developers with Magento tutorial e-book, step-by-step guide, latest Magento tutorial video and up-to-date news
You Are Here: Home » All tutorial » Get Customer Group within Magento

Get Customer Group within Magento

Get Customer Group within Magento

Magento is built to work with different groups of users/customers.

You can easily find out what group the customer belongs to by the snippet below.

// Mage_Customer_Session
$session = Mage::getSingleton('customer/session');

// Get the Customer Group ID.
$group_id = $session->getCustomerGroupId();

// Get the Group Name the Customer is part of.
$group_name = Mage::getModel('customer/group')->load($group_id)->getCode();

Note: Customers must be log in.

You can check whether a customer is logged in by simply,
if($session->isLoggedIn()) {

// Customer is logged in :)

} else {

// Not logged in :(

}

About The Author

Number of Entries : 304

Leave a Comment

Scroll to top
" "