I have created a module, which creates one custom customer address attribute. In my attribute I have visible true, Now I need to visible false. I need to update that attribute. My code is as below:
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]); $customerSetup->updateAttribute('customer_address', 'custom_id', [ 'is_visible' => false, ]); $attribute = $customerSetup->getEavConfig()->getAttribute('customer_address', 'custom_id') ->setData([ 'used_in_forms' => [], ]); $attribute->save(); $setup->endSetup(); }
it's giving error "Unique constraint violation". How could I update this attribute
Thanks.