Skip to content

Commit 0718051

Browse files
committed
ACP2E-751
Unable to save customer account after editing "Street address" attribute
1 parent f1adf23 commit 0718051

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

app/code/Magento/Customer/Model/Address/DataProvider.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,15 @@ private function getAttributesMeta(Type $entityType): array
235235
$customer = $this->customerRepository->getById($customerId);
236236
$attributes->setWebsite($customer->getWebsiteId());
237237
}
238+
$customerAddress = $customer->getAddresses()[0];
239+
240+
$customerStreetAddressLines = 0;
241+
if($customerAddress !== null){
242+
$customerStreetAddress = $customerAddress->getStreet();
243+
if($customerStreetAddress !== null){
244+
$customerStreetAddressLines = count($customerStreetAddress);
245+
}
246+
}
238247

239248
/* @var AbstractAttribute $attribute */
240249
foreach ($attributes as $attribute) {
@@ -245,11 +254,16 @@ private function getAttributesMeta(Type $entityType): array
245254
continue;
246255
}
247256

248-
$meta[$attribute->getAttributeCode()] = $this->attributeMetadataResolver->getAttributesMeta(
257+
$attributeCode = $attribute->getAttributeCode();
258+
$meta[$attributeCode] = $this->attributeMetadataResolver->getAttributesMeta(
249259
$attribute,
250260
$entityType,
251261
$this->allowToShowHiddenAttributes
252262
);
263+
if($attributeCode === 'street' && $customerStreetAddressLines !== 0){
264+
$meta[$attributeCode]["arguments"]["data"]["config"]["size"] = max(
265+
$meta[$attributeCode]["arguments"]["data"]["config"]["size"],$customerStreetAddressLines);
266+
}
253267
}
254268
$this->attributeMetadataResolver->processWebsiteMeta($meta);
255269

0 commit comments

Comments
 (0)