File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
app/code/Magento/Checkout/Controller/Cart Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
/**
3
- *
4
3
* Copyright © Magento, Inc. All rights reserved.
5
4
* See COPYING.txt for license details.
6
5
*/
7
6
namespace Magento \Checkout \Controller \Cart ;
8
7
9
8
use Magento \Framework \App \Action \HttpPostActionInterface as HttpPostActionInterface ;
10
9
10
+ /**
11
+ * Action Delete.
12
+ *
13
+ * Deletes item from cart.
14
+ */
11
15
class Delete extends \Magento \Checkout \Controller \Cart implements HttpPostActionInterface
12
16
{
13
17
/**
@@ -24,7 +28,12 @@ public function execute()
24
28
$ id = (int )$ this ->getRequest ()->getParam ('id ' );
25
29
if ($ id ) {
26
30
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 ();
28
37
} catch (\Exception $ e ) {
29
38
$ this ->messageManager ->addErrorMessage (__ ('We can \'t remove the item. ' ));
30
39
$ this ->_objectManager ->get (\Psr \Log \LoggerInterface::class)->critical ($ e );
You can’t perform that action at this time.
0 commit comments