Magento2 I am programmatiacally removing cart items.

$quoteItems = $this->checkoutSession->getQuote()->getItemsCollection();
            foreach($quoteItems as $item)

My issue is mini cart counter is not getting updated

It just gets reduced by 1. Lets say if I have 3 items it will get reduced by 1 & change to 2.

I have already tried

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <action name="inquiry/index/save">
        <section name="cart"/>

And this

var sections = ['cart'];
customerData.reload(sections, true);

1 Answer 1


Try this code

$quoteItems = $this->checkoutSession->getQuote()->getItemsCollection();
    foreach($quoteItems as $item)

    //or use this 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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