Skip to content

Commit 1495a66

Browse files
author
Mastiuhin Olexandr
committed
Merge branch 'MAGETWO-95312' into 2.3-develop-pr10
2 parents 468d2ac + ac753fd commit 1495a66

File tree

1 file changed

+11
-2
lines changed
  • app/code/Magento/Checkout/Controller/Cart

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\Checkout\Controller\Cart;
87

98
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
109

10+
/**
11+
* Action Delete.
12+
*
13+
* Deletes item from cart.
14+
*/
1115
class Delete extends \Magento\Checkout\Controller\Cart implements HttpPostActionInterface
1216
{
1317
/**
@@ -24,7 +28,12 @@ public function execute()
2428
$id = (int)$this->getRequest()->getParam('id');
2529
if ($id) {
2630
try {
27-
$this->cart->removeItem($id)->save();
31+
$this->cart->removeItem($id);
32+
// We should set Totals to be recollected once more because of Cart model as usually is loading
33+
// before action executing and in case when triggerRecollect setted as true recollecting will
34+
// executed and the flag will be true already.
35+
$this->cart->getQuote()->setTotalsCollectedFlag(false);
36+
$this->cart->save();
2837
} catch (\Exception $e) {
2938
$this->messageManager->addErrorMessage(__('We can\'t remove the item.'));
3039
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);

0 commit comments

Comments
 (0)