I try to add customer group name in new order transactional email but I can't find anything about this.

I found this link : http://www.justwebdevelopment.com/blog/transactional-emails-variable-magento/ but here it's not anything related to customer group name.

Does anyone know how can I do this?

1 Answer 1


You should be override some of files for add your custom variable in mail.

First copy app\code\core\Mage\Sales\Model\Order.php to app\code\local\Mage\Sales\Model\Order.php

Create function for your requirement. If your order data return value for customer group as $order['customer_group'] then you have to declare function in Order.php file of local.

public function getCustomerGroup(){
 //find customer group from order customer and return it or load order model to get customer groupid.
    return $order->getCustomerGroupId();

You have to set value in System -> Transactional email -> New order template.

You have to set below statement in your email template.
{{var order.getCustomerGroup()}}

Now email template will display Customer Group value.

Set this email template from System -> Configuration -> Sales -> Sales email -> Order -> New Order Confirmation Template -> Save.

Hope this will help you.

  • Then, do i have to put the only function you noted on local order.php ?
    – 3CE
    Commented Apr 6, 2017 at 13:38
  • thanks. it works. i mean i recive the id, but i want the name Commented Apr 6, 2017 at 14:06
  • but i solve the problem with the namepublic function getCustomerGroup(){ if ($groupId = $this->getCustomerGroupId()){ $group = Mage::getModel ('customer/group')->load($groupId); if ($group->getId()){ return $group->getCode(); } } return ''; } Commented Apr 6, 2017 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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