Skip to content

Commit 40a0f13

Browse files
committed
MCP-792: Wrong error message is sent in email if order is rejected because of disabled product
1 parent fea0bba commit 40a0f13

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ public function savePaymentInformationAndPlaceOrder(
120120
//Have to do this hack because of savePaymentInformation() plugins.
121121
$this->saveRateLimitDisabled = true;
122122
$this->savePaymentInformation($cartId, $email, $paymentMethod, $billingAddress);
123+
} catch (\Magento\Framework\Exception\LocalizedException $e) {
124+
$this->getLogger()->critical(
125+
'Placing an order with quote_id ' . $cartId . ' is failed: ' . $e->getMessage()
126+
);
127+
throw new CouldNotSaveException(
128+
__($e->getMessage()),
129+
$e
130+
);
123131
} finally {
124132
$this->saveRateLimitDisabled = false;
125133
}
@@ -176,6 +184,10 @@ public function savePaymentInformation(
176184
}
177185
$this->limitShippingCarrier($quote);
178186

187+
if (!$quote->getItemsQty()) {
188+
throw new CouldNotSaveException(__('Some of the products are disabled.'));
189+
}
190+
179191
$this->paymentMethodManagement->set($cartId, $paymentMethod);
180192
return true;
181193
}

0 commit comments

Comments
 (0)