Skip to content

Commit fc35ac4

Browse files
committed
ACP2E-1117: CustomerAddressId not set for new billing address
1 parent 8563510 commit fc35ac4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/code/Magento/Quote/Model/QuoteManagement.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,10 @@ protected function _prepareCustomerQuote(Quote $quote)
674674
}
675675

676676
if ((!$billing->getCustomerId() || $billing->getSaveInAddressBook())
677-
&& ($shipping && (!$shipping->getSameAsBilling() || !$shipping->getCustomerAddressId()))) {
677+
&& (
678+
$shipping === null
679+
|| ($shipping && (!$shipping->getSameAsBilling() || !$shipping->getCustomerAddressId()))
680+
)) {
678681
if ($billing->getQuoteId()) {
679682
$billingAddress = $billing->exportCustomerAddress();
680683
} else {
@@ -705,14 +708,14 @@ protected function _prepareCustomerQuote(Quote $quote)
705708
$billing->setCustomerAddressId($billingAddress->getId());
706709

707710
// Admin order: `Same As Billing Address`- when new billing address saved in address book
708-
if (!empty($shipping)
711+
if ($shipping !== null
709712
&& !$shipping->getCustomerAddressId()
710713
&& $shipping->getSameAsBilling()) {
711714
$shipping->setCustomerAddressId($billingAddress->getId());
712715
}
713716
}
714717
}
715-
if (!empty($shipping) && $shipping->getSameAsBilling() && !$billing->getCustomerAddressId()) {
718+
if ($shipping !== null && $shipping->getSameAsBilling() && !$billing->getCustomerAddressId()) {
716719
$billing->setCustomerAddressId($shipping->getCustomerAddressId());
717720
}
718721
if ($shipping && !$shipping->getCustomerId() && !$hasDefaultBilling) {

0 commit comments

Comments
 (0)