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 11<?php
22/**
3- *
43 * Copyright © Magento, Inc. All rights reserved.
54 * See COPYING.txt for license details.
65 */
76namespace Magento \Checkout \Controller \Cart ;
87
98use Magento \Framework \App \Action \HttpPostActionInterface as HttpPostActionInterface ;
109
10+ /**
11+ * Action Delete.
12+ *
13+ * Deletes item from cart.
14+ */
1115class 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 );
You can’t perform that action at this time.
0 commit comments