Can anyone explain me how and where I can customize the add to cart button functionality based on the current customer group? I’d like to show a popup or redirect to a CMS page but only for a specific customer group.

Any help will be much appreciated!

Thanks in advance! Damian

  • which magento version ? from where you want to redirct (controller/phtml)? – Pawan Aug 11 '18 at 1:07
  • Sorry I forgot that detail... I’m using version 1.9 and not sure if controller or phtml, which one would you recommend? The only important detail is that every add to cart button must behave the same way. Thanks! – Damil Aug 11 '18 at 1:14

You can check first customer is logged in or not, If logged in get customer Group. based on group you can Pop Up message.

$login = Mage::getSingleton('customer/session')->isLoggedIn(); //Check if User is Logged In
    $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId(); //Get Customers Group ID

    $group = Mage::getModel('customer/group')->load($groupId);

    $groupName = $group->getCode();

    if($groupName == 'General'){

    //Here should be Pop up code


Edit I: If you want to redirect to CMS page you can use:


Edit II :

If you want to replace add to cart button based on customer group you can edit below file:


You can put above code in your phtml file where you want to check customer group.

  • I understand, but how do I find out which phtml file I need to use? That’s were I’m quite lost. – Damil Aug 11 '18 at 1:57
  • please see updated answer – Pawan Aug 11 '18 at 2:03
  • Welcome @DamianLobalzo :) – Pawan Aug 11 '18 at 2:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.