I am facing this annoying issue in Magento 2.0.7 where, after checking out, the items are not cleared from the mine cart.

Those items in the mini cart are loading from the cache storage.

Is there any way we can clear that cache?

I checked the local storage in my browser, and it has data stored in "cart":{} parameter of the JSON string. Which if I manually clear, the mini cart gets empty.

  • @ Taral Patoliya Hope you can find solution the at magento.stackexchange.com/questions/100615/… – Krishna ijjada Jul 25 '16 at 7:13
  • @krishnaijjada There are only a handful of questions about the above issue, and the question you mensioned above is one of them. but they could not solve the issue. – Taral Patoliya Jul 25 '16 at 7:16
  • Should check the latest version. This issue has been fixed. See my answer. – Khoa TruongDinh Jul 26 '16 at 13:14

There is a temporary solution for you, we need to override vendor/magento/module-checkout/view/frontend/web/js/view/payment/default.js because if we take a look at this file, we can see:

         * After place order callback
        afterPlaceOrder: function () {
            // Override this function and put after place order logic here

We will write the code to remove local storegare here.

We can read more here: Getting the product SKU in the header mini-cart to understand more about the mini cart data.

Note: we should find the root cause of your issue.

UPDATE: 26-Jul-16

A fix from Magento Community here.


         $this->_quote = null;
 +        $this->setLoadInactive(false);
 +        $this->replaceQuote($this->getQuote()->save());
          return $this;


          <a class="action primary continue" href="<?php /* @escapeNotVerified */ echo $block->getUrl() ?>"><span><?php /* @escapeNotVerified */ echo __('Continue Shopping') ?></span></a>
 +    <script>
 +        require([
 +            'Magento_Customer/js/customer-data'
 +        ], function (customerData) {
 +            var sections = ['cart'];
 +            customerData.invalidate(sections);
 +            customerData.reload(sections, true);
 +        });
 +    </script>
| improve this answer | |
  • This works when user already signed in. still getting the problem when guest user placing order, any solutions for guest user? – Vishwa Feb 14 '18 at 6:24
$metadata = $this->_cookieMetadataFactory
$sectiondata = json_decode($this->_cookieManager->getCookie('section_data_ids'));
$sectiondata->cart += 1000;

use Magento\Framework\Session\SessionManagerInterface;
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;

CookieManagerInterface $cookieManager,
CookieMetadataFactory $cookieMetadataFactory,
| improve this answer | |

Please add below small script in following file path. it's work for me.



 ], function (customerData) {
     var sections = ['cart'];
     //customerData.reload(sections, true);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.