Skip to content

Commit 887c545

Browse files
committed
Merge remote-tracking branch 'origin/MC-33361' into 2.4-develop-pr23
2 parents 577b3b3 + 397888b commit 887c545

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

app/code/Magento/Customer/Controller/Account/CreatePost.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ class CreatePost extends AbstractAccount implements CsrfAwareActionInterface, Ht
149149
*/
150150
private $customerRepository;
151151

152+
/**
153+
* @var ScopeConfigInterface
154+
*/
155+
private $scopeConfig;
156+
152157
/**
153158
* @param Context $context
154159
* @param Session $customerSession
@@ -266,9 +271,15 @@ protected function extractAddress()
266271
$addressData = [];
267272

268273
$regionDataObject = $this->regionDataFactory->create();
274+
$userDefinedAttr = $this->getRequest()->getParam('address') ?: [];
269275
foreach ($allowedAttributes as $attribute) {
270276
$attributeCode = $attribute->getAttributeCode();
271-
$value = $this->getRequest()->getParam($attributeCode);
277+
if ($attribute->isUserDefined()) {
278+
$value = array_key_exists($attributeCode, $userDefinedAttr) ? $userDefinedAttr[$attributeCode] : null;
279+
} else {
280+
$value = $this->getRequest()->getParam($attributeCode);
281+
}
282+
272283
if ($value === null) {
273284
continue;
274285
}
@@ -283,6 +294,9 @@ protected function extractAddress()
283294
$addressData[$attributeCode] = $value;
284295
}
285296
}
297+
$addressData = $addressForm->compactData($addressData);
298+
unset($addressData['region_id'], $addressData['region']);
299+
286300
$addressDataObject = $this->addressDataFactory->create();
287301
$this->dataObjectHelper->populateWithArray(
288302
$addressDataObject,

0 commit comments

Comments
 (0)