cancel
Showing results for 
Search instead for 
Did you mean: 

Customer Groups and Custom Group Attributes

Customer Groups and Custom Group Attributes

Is there a way to programmatically or with a module, add additional fields to customer groups?

 

We'd like to add company address information to each group.

3 REPLIES 3

Re: Customer Groups and Custom Group Attributes

$installer = $this;
$connection = $installer->getConnection();
 
$installer->startSetup();
 
$installer->getConnection()
    ->addColumn($installer->getTable('customer/customer_group'),
    'your_custom_column_name_1',
    array(
        'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
        'nullable' => true,
        'default' => null,
        'comment' => 'Your comment 1'
    ))->addColumn('your_custom_column_name_2', Varien_Db_Ddl_Table::TYPE_TEXT, 32, array(
        'nullable'  => false,
        ), 'Your comment 2');
 
$installer->endSetup();

Re: Customer Groups and Custom Group Attributes

Hi,

 

I've included a video here: https://www.youtube.com/watch?v=OyRImQWmNyk

Concerning How to Create a Customer Group in Magento. It might be useful.

Re: Customer Groups and Custom Group Attributes

 

  • Yes, it's possible to add custom attributes to customer groups in platforms like Magento or similar systems through custom modules or programmatic methods.

  • You can create a custom module that extends the customer group entity, allowing additional fields like company address to be stored.

  • Use setup scripts in your module to create new EAV (Entity-Attribute-Value) attributes or flat table columns, depending on your platform structure.

  • For example, to add a "Company Address" field, define it in your InstallData or UpgradeData script during module setup.

  • Once created, you can expose these custom fields in the admin panel by overriding the customer group edit templates.

  • If you're using a system like Magento, you might use the \Magento\Eav\Setup\EavSetup class to handle attribute creation.

  • For a real-world use case: imagine menu managing B2B customer groups — they could group franchises by region and assign company addresses to each group for internal logistics and franchisee support.

  • To make the fields functional, create form UI components so that admin users can edit and view the new fields easily.

  • You can also access these custom group attributes in frontend or backend logic, for example, filtering customer behavior based on group location.

  • If using APIs, consider extending the REST or GraphQL endpoints to expose your custom fields as needed.

  • Make sure to validate and sanitize input properly to maintain security and data integrity.

  • Ultimately, whether you’re organizing customers for a local shop or global chain like Popeyes, custom customer group fields help tailor data management to your operational needs.