Skip to content

Commit 3b63da0

Browse files
committed
MAGETWO-64714: [GitHub] [PR] Fix quote's outdated shipping address overwriting PayPal Express shipping address #8568
- Merge Pull Request #8568 from torreytsui/magento2:patch-5
2 parents 33c769b + 60a2a21 commit 3b63da0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

app/code/Magento/Braintree/Model/Paypal/Helper/QuoteUpdater.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ private function updateQuote(Quote $quote, array $details)
8484

8585
$quote->collectTotals();
8686

87+
/**
88+
* Unset shipping assignment to prevent from saving / applying outdated data
89+
* @see \Magento\Quote\Model\QuoteRepository\SaveHandler::processShippingAssignment
90+
*/
91+
if ($quote->getExtensionAttributes()) {
92+
$quote->getExtensionAttributes()->setShippingAssignments(null);
93+
}
94+
8795
$this->quoteRepository->save($quote);
8896
}
8997

@@ -164,5 +172,10 @@ private function updateAddressData(Address $address, array $addressData)
164172
$address->setRegionCode($addressData['region']);
165173
$address->setCountryId($addressData['countryCodeAlpha2']);
166174
$address->setPostcode($addressData['postalCode']);
175+
176+
// PayPal's address supposes not saving against customer account
177+
$address->setSaveInAddressBook(false);
178+
$address->setSameAsBilling(false);
179+
$address->setCustomerAddressId(null);
167180
}
168181
}

0 commit comments

Comments
 (0)