How to get Current Customer Group id in Magento.?

With the following code one can easily get the specific Current customer group id with logged in or session information.

Mage::getSingleton(‘customer/session’)->getCustomerGroupId(); is used to get current customer group id details with logged info is checked before to get the suitable information.
/* Check if customer is logged in */
$isLogIn = Mage::getSingleton('customer/session')->isLogIn();

/* If customer is logged in */
if($isLogIn) :
    /* Get the logged in customer's group ID */
$customerGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
}else{

$customerGroupId = "";

}

You can also use this code in static block or custom variable to get the specific group information from the current group user!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *