Skip to content

Commit

Permalink
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php
Original file line number Diff line number Diff line change
@@ -315,26 +315,35 @@ protected function getMultilineFieldConfig($attributeCode, array $attributeConfi
*/
protected function getDefaultValue($attributeCode)
{
if ($attributeCode === 'country_id') {
return $this->directoryHelper->getDefaultCountry();
}

$customer = $this->getCustomer();
if ($customer === null) {
return null;
}

$attributeValue = null;
switch ($attributeCode) {
case 'prefix':
$attributeValue = $customer->getPrefix();
break;
case 'firstname':
if ($this->getCustomer()) {
return $this->getCustomer()->getFirstname();
}
$attributeValue = $customer->getFirstname();
break;
case 'middlename':
if ($this->getCustomer()) {
return $this->getCustomer()->getMiddlename();
}
$attributeValue = $customer->getMiddlename();
break;
case 'lastname':
if ($this->getCustomer()) {
return $this->getCustomer()->getLastname();
}
$attributeValue = $customer->getLastname();
break;
case 'suffix':
$attributeValue = $customer->getSuffix();
break;
case 'country_id':
return $this->directoryHelper->getDefaultCountry();
}
return null;

return $attributeValue;
}

/**

0 comments on commit 26a7c33

Please sign in to comment.