Skip to content

Commit

Permalink
Bug Fixed: [Duplicate orders with same Quote Id at same time with few…
Browse files Browse the repository at this point in the history
… time difference.](magento#13952)
  • Loading branch information
fiko committed Aug 12, 2022
1 parent f9adcd9 commit 1308833
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/code/Magento/Quote/Model/QuoteManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ protected function createCustomerCart($customerId, $storeId)
public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
{
$quote = $this->quoteRepository->getActive($cartId);
$quote->setIsActive(false);
$this->quoteRepository->save($quote);
$customer = $quote->getCustomer();
$customerId = $customer ? $customer->getId() : null;

Expand Down Expand Up @@ -611,6 +613,8 @@ protected function submitQuote(QuoteEntity $quote, $orderData = [])
);
$this->quoteRepository->save($quote);
} catch (\Exception $e) {
$quote->setIsActive(1);
$this->quoteRepository->save($quote);
$this->rollbackAddresses($quote, $order, $e);
throw $e;
}
Expand Down

0 comments on commit 1308833

Please sign in to comment.