Skip to content

Commit e8dbe33

Browse files
author
Mastiuhin Olexandr
committed
MAGETWO-93262: Cart is not empty after removing the product
1 parent a7dcd7b commit e8dbe33

File tree

1 file changed

+6
-1
lines changed
  • app/code/Magento/Checkout/Controller/Cart

1 file changed

+6
-1
lines changed

app/code/Magento/Checkout/Controller/Cart/Delete.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ public function execute()
2222
$id = (int)$this->getRequest()->getParam('id');
2323
if ($id) {
2424
try {
25-
$this->cart->removeItem($id)->save();
25+
$this->cart->removeItem($id);
26+
// We should set Totals to be recollected once more because of Cart model as usually is loading
27+
// before action executing and in case when triggerRecollect setted as true recollecting will
28+
// executed and the flag will be true already.
29+
$this->cart->getQuote()->setTotalsCollectedFlag(false);
30+
$this->cart->save();
2631
} catch (\Exception $e) {
2732
$this->messageManager->addError(__('We can\'t remove the item.'));
2833
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);

0 commit comments

Comments
 (0)