Skip to content

Commit 6dfaf8c

Browse files
committed
ACP2E-751: Unable to save customer account after editing "Street address" attribute
Logic improved as per CR comments for "easier understanding"
1 parent 5336d7b commit 6dfaf8c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,8 @@ private function getAttributesMeta(Type $entityType): array
227227
$attributes = $entityType->getAttributeCollection();
228228
$customerId = $this->context->getRequestParam('parent_id');
229229
$entityId = $this->context->getRequestParam('entity_id');
230-
$customerStreetAddressLines = 0;
231230
if (!$customerId && $entityId) {
232231
$customerId = $this->addressRegistry->retrieve($entityId)->getParentId();
233-
$customerStreetAddress = $this->addressRegistry->retrieve($entityId)->getStreet();
234-
$customerStreetAddressLines = count($customerStreetAddress);
235232
}
236233

237234
if ($customerId) {
@@ -251,10 +248,11 @@ private function getAttributesMeta(Type $entityType): array
251248
$entityType,
252249
$this->allowToShowHiddenAttributes
253250
);
254-
if ($attribute->getAttributeCode() === 'street' && $customerStreetAddressLines !== 0) {
251+
if ($attribute->getAttributeCode() === 'street' && $entityId) {
252+
$customerAddressStreet = $this->addressRegistry->retrieve($entityId)->getStreet();
255253
$meta[$attribute->getAttributeCode()]["arguments"]["data"]["config"]["size"] = max(
256254
$meta[$attribute->getAttributeCode()]["arguments"]["data"]["config"]["size"],
257-
$customerStreetAddressLines
255+
count($customerAddressStreet)
258256
);
259257
}
260258
}

0 commit comments

Comments
 (0)