I have created a custom attribute of type customer_address and I would like to have the API to return me the value as an attribute when I call the API to receive an order.
Attribute:
private function upgradeExternalKeyAddressCustomer($customerSetup)
{
$attributesInfo = [
'mod_external_key' => [
'label' => __('External Key'),
'type' => 'varchar',
'input' => 'text',
'position' => 200,
'visible' => 1,
'required' => 0,
'system' => 0,
],
];
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();
}
}
How to do this?