1

We're experiencing the same problem, even in Magento 2.2.7 version.

https://stackoverflow.com/questions/52619136/magento2-save-new-address-attribute-in-checkout

Newly added custom attributes are present on first "Shipping" step but when on "Review & Payments" step these fields are no longer present, hence not sent to form. Or in our case, an error apper since they are required and values are not set.

Did someone find how to solve it?

In my case:

    $attributesInfo = [
        'gsp_address_type'  => [
            'label' => __('Address Type'),
            'type' => 'varchar',
            'input' => 'select',
            'source' => 'Mod\Module\Model\Data\AddressType',
            'position' => 1,
            'visible' => 1,
            'required' => 1,
        ],
    ];

    foreach ($attributesInfo as $attributeCode => $attributeParams) {
        $customerSetup->addAttribute('customer_address', $attributeCode, $attributeParams);
    }

    foreach ($attributesInfo as $attributeCode => $attributeParams) {
        $attribute = $customerSetup->getEavConfig()->getAttribute('customer_address', $attributeCode);
        $attribute->setData(
            'used_in_forms',
            ['adminhtml_customer_address', 'customer_address_edit', 'customer_register_address']
        );
        $attribute->save();
    }

enter image description here enter image description here

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.