0

I want to create a custom address attribute, I need them visible in all the following places.

  1. Admin Addresses.
  2. My Account Address Box
  3. Checkout address and forms.

How can I implement to have them on billing and shipping address.

1 Answer 1

0

You can create custom attribute from installSchema or upgrade schema.

$eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]);
        $eavSetup->addAttribute('customer_address', 'type', array(
            'type' => 'int',
            'input' => 'select',
            'label' => 'Address Type',
            'source'=>'Web4pro\Ajaxcart\Model\Address\Type',
            'global' => 1,
            'visible' => 1,
            'required' => 1,
            'user_defined' => 1,
            'system'=>0,
            'group'=>'General',
            'visible_on_front' => 1,
        ));
        $eavSetup->getEavConfig()->getAttribute('customer_address','type')
               ->setUsedInForms(array('adminhtml_customer_address','customer_address_edit','customer_register_address'))
               ->save();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.