How to clear cart and minicart programatically in Magento 2??
I am using this code
$quoteId = $this->_checkoutSession->getQuote()->getId();
$quoteModel = $this->objectManager->create('Magento\Quote\Model\Quote');
$quoteItem = $quoteModel->load($quoteId);
$quoteItem->delete();
this clears cart but minicart items are still showing.. Can anyone please help me to fix this issue??
thanks
Best Answer
The mini cart items are from browser local storage. That means you need to reload the frontend cart section as well. An example here: https://magento.stackexchange.com/a/184745/33057