Skip to content

Commit 26a7c33

Browse files
author
Oleksii Korshenko
authored
MAGETWO-69848: Fix #9924, prefill prefix and suffix in checkout shipping address #9925
2 parents 4c3a3bd + 5186c90 commit 26a7c33

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -315,26 +315,35 @@ protected function getMultilineFieldConfig($attributeCode, array $attributeConfi
315315
*/
316316
protected function getDefaultValue($attributeCode)
317317
{
318+
if ($attributeCode === 'country_id') {
319+
return $this->directoryHelper->getDefaultCountry();
320+
}
321+
322+
$customer = $this->getCustomer();
323+
if ($customer === null) {
324+
return null;
325+
}
326+
327+
$attributeValue = null;
318328
switch ($attributeCode) {
329+
case 'prefix':
330+
$attributeValue = $customer->getPrefix();
331+
break;
319332
case 'firstname':
320-
if ($this->getCustomer()) {
321-
return $this->getCustomer()->getFirstname();
322-
}
333+
$attributeValue = $customer->getFirstname();
323334
break;
324335
case 'middlename':
325-
if ($this->getCustomer()) {
326-
return $this->getCustomer()->getMiddlename();
327-
}
336+
$attributeValue = $customer->getMiddlename();
328337
break;
329338
case 'lastname':
330-
if ($this->getCustomer()) {
331-
return $this->getCustomer()->getLastname();
332-
}
339+
$attributeValue = $customer->getLastname();
340+
break;
341+
case 'suffix':
342+
$attributeValue = $customer->getSuffix();
333343
break;
334-
case 'country_id':
335-
return $this->directoryHelper->getDefaultCountry();
336344
}
337-
return null;
345+
346+
return $attributeValue;
338347
}
339348

340349
/**

0 commit comments

Comments
 (0)