Fixing a Sticky Mini Cart in Magento 2

We recently had an eCommerce client who was approaching the final stages of their new Magento website. Internal and external QA was winding down, a launch date was set and the hosting move had been scheduled.

Our team performed one more checkout test. It went perfectly. Shipping rules, coupon codes and payment options: check, check and check. The “Thank You Page” page looked beautiful.


“Wait, what is that? Why is the mini cart showing items?” After the team looked through the code they wondered, “Everything checks out, what the?”

“It must be a sessions issue.” After the developers flushed cache and tested checkout in incognito mode they found, “Still there.”

Then it was time to turn to Google.

Ah, there it was, a known Magento 2 bug.

Luckily, a fix from Magento Community was (and still is) available here. The Magento Community has a strong online presence. Developers band together to help one another with everything from bugs to solutioning. This community simultaneously increases developer efficiency while saving money for business owners around the world.

Our team implemented the code and retested checkout. This time, the mini cart was empty. The fix works! **mini celebration dance**

See the code we used below:











Bugs happen, especially in recently released software. There are a lot of “fixes” out there, but not all of them work. We can confirm this one is a bonafide fix. And for the cases when a fix hasn’t been released yet? Well, that is for another blog post.

If you are still on Magento 1 and wondering whether it’s time to switch to Magento 2? Our article Moving from Magneto 1 to Magneto 2: All Your Questions Answered gets into the nitty gritty details.

Are you having trouble getting your store’s shopping cart to work the way it’s supposed to? Get in touch with our team at [email protected].



Let’s Get In Touch

Our team would love to talk with you about your goals for your business and how our experienced developers and designers can help you achieve those goals. Whether you have a simple question or a complex upcoming project, please don’t hesitate to reach out.

  • We'll be in contact soon!
  • This field is for validation purposes and should be left unchanged.