Skip to content

Commit 78b5ad5

Browse files
MAGETWO-99624: [Magento Cloud] Checkout not possible with zero sum checkout for virtual products
1 parent 605ae1e commit 78b5ad5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

app/code/Magento/Checkout/Model/PaymentInformationManagement.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ public function savePaymentInformation(
112112
$quoteRepository = $this->getCartRepository();
113113
/** @var \Magento\Quote\Model\Quote $quote */
114114
$quote = $quoteRepository->getActive($cartId);
115+
$customerId = $quote->getBillingAddress()
116+
->getCustomerId();
117+
if (!$billingAddress->getCustomerId() && $customerId) {
118+
//It's necessary to verify the price rules with the customer data
119+
$billingAddress->setCustomerId($customerId);
120+
}
115121
$quote->removeAddress($quote->getBillingAddress()->getId());
116122
$quote->setBillingAddress($billingAddress);
117123
$quote->setDataChanges(true);

app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private function getMockForAssignBillingAddress($cartId, $billingAddressMock)
179179
['setLimitCarrier', 'getShippingMethod', 'getShippingRateByCode']
180180
);
181181
$this->cartRepositoryMock->expects($this->any())->method('getActive')->with($cartId)->willReturn($quoteMock);
182-
$quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($quoteBillingAddress);
182+
$quoteMock->method('getBillingAddress')->willReturn($quoteBillingAddress);
183183
$quoteMock->expects($this->once())->method('getShippingAddress')->willReturn($quoteShippingAddress);
184184
$quoteBillingAddress->expects($this->once())->method('getId')->willReturn($billingAddressId);
185185
$quoteMock->expects($this->once())->method('removeAddress')->with($billingAddressId);

0 commit comments

Comments
 (0)