I have created address_nationality attribute using script

$customerSetup -> addAttribute('customer_address',
        'label' => 'Nationality',
        'system' => 0,
        'user_defined' => true,
        'position' => 110,
        'sort_order' =>110,
        'visible' =>  true,
        'default_value' => '',
        'note' => '',
        'type' => 'varchar',
        'input' => 'text',
    $customerSetup -> getEavConfig() -> getAttribute('customer_address', 'address_nationality')->setData('is_user_defined',1)->setData('default_value','')-> setData('used_in_forms', ['adminhtml_customer_address', 'customer_register_address', 'customer_address_edit']) -> save();

In address book I am trying to save value of address_nationality but it is not getting saved.

1 Answer 1


If I'm not mistaking you need to add the attribute to the customer_form_attribute as well:

    ['adminhtml_customer_address', 'customer_address_edit', 'customer_register_address']

I'm guessing that you can use the used_in_forms-parameter in the creation of the attribute as well.

  • I have already added. It is there in customer_form_attribute table
    – jassi
    Oct 26, 2017 at 8:34

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.