1

I added this code to my InstallData script:

     $eavSetup->removeAttribute('customer_address', 'erp_address_system_id');
     $eavSetup->addAttribute(
         'customer_address', 'additional_address_field', [
             'type' => 'text',
             'label' => 'Addtional address field',
             'input' => 'text',
             'required' => false,
             'visible' => true,
             'filterable_in_search' => true,
             'is_visible_on_front' => 0,
             'filterable' => true,
             'system' => 0,
             'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
             'position' => 500,
             'sort_order' => 500
         ]
     );

     $customAttribute = $this->attributeRepository->get('customer_address', 'additional_address_field');
     $setup->getConnection()
         ->insertOnDuplicate(
             $setup->getTable('customer_form_attribute'),
             [
                 ['form_code' => 'adminhtml_customer_address', 'attribute_id' => $customAttribute ->getId()],
             ]
         );
     $customAttribute ->save();

When I try to import customer and address data in one file (entity: customer_composite) and I add the attribute as column 'additional_address_field' the value is still empty in the backend. When I manually enter a value in the backend the value is stored.

Why's that? How can I import a custom address attribute?

  • Can you please try this _address_additional_address_field in your csv file header and let me know.? – Abdul Apr 23 '18 at 5:57
  • I already tried this, but Magento told me that this column is unknown. – Jens Apr 23 '18 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.