I have created a custom check box field in billing.phtml(Magento, i want to assign customer group based on this field (i,e.. if the field is check the customer will be in one customer group and if the field is not checked the customer will be in another customer group.). how to do this ?

1 Answer 1


You can do by observing customer save before event.


Replace Namespace_Module with your module name.

class Namespace_Module_Model_Observer
    public function customer_save_before($observer)
        $group_id = 3; //Change this to your id
        $customer = $observer->getCustomer();
        //echo "<pre>"; print_r( $customer->getData() );
        Mage::log( $customer->getData() , null, 'customer_Before.log');        


Change $group_id value to your value.

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.