I have searched lots of links on google but can't find any relevant answer. Can anybody help ? I want to create customer group attribute.
-
What sort of attribute are you looking to create? You're more likely to get better answers if you specify exactly what you want/need– JohnCommented Feb 13, 2018 at 11:53
-
Need to create customer groups attribute, Not customer attribute.– user63697Commented Feb 13, 2018 at 12:32
Add a comment
|
1 Answer
If you want to add a customer attribute you can do it from a Setup file as follows :
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
\Magento\Customer\Model\Customer::ENTITY,
'sample_attribute',
[
'type' => 'varchar',
'label' => 'Sample Attribute',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'position' => 999,
'system' => 0,
]
);
In case an address attribute is needed its here
-
Your code will create customer attribute not customer group attribute.– user63697Commented Feb 13, 2018 at 12:33
-
i do not think customer groups are eav driven, i think you need to add a column in customer_group table Commented Feb 13, 2018 at 12:46
-
Yes, i yes have already added column but i need to display it at grid and also need to add more columns such as image upload, dropdown etc. it will displays when we open group at admin.– user63697Commented Feb 13, 2018 at 12:47
-