Written the below code in the existing module customfield->setup->InstallData.php
Code:
$eavSetup->addAttribute(Customer::ENTITY, 'is_terms_available', [
// Attribute parameters
'type' => 'varchar',
'label' => 'Terms Available',
'input' => 'select',
'class' => '',
'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
'backend' => '',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 990,
'position' => 990,
'system' => 0,
'default' => 0,
'is_used_in_grid'=> true,
'is_visible_in_grid'=> true,
]);
$attribute = $this->eavConfig->getAttribute(Customer::ENTITY, 'is_terms_available');
$attribute->setData('attribute_set_id', $attributeSetId);
$attribute->setData('attribute_group_id', $attributeGroupId);
$attribute->setData('used_in_forms', [
'adminhtml_customer',
'customer_account_create'
]);
$this->attributeResource->save($attribute);
After this we need to delete the folder in setup module in our database, And after that;
- php bin/magento setup:upgrade
- php bin/magento setup:di:compile
- php bin/magento s:s:d -f en_US –theme Swissup/argento-marketplace
- sudo chmod 777 -R /var/www/html/Szco_Supplies_Magento_Nestuite_website/
After this, it will be as shown in the screenshot below.
Screenshot:
