Magento 2 offers a mini cart feature that allows the visitors to conveniently check their cart items and other details without having to leave the current page and load the cart page.
Mini cart improves the on-site experience of any online store. However, Magento developers have noted an issue of mini cart not refreshing when a visitor adds or removes an item or make any changes in the cart. You can also show additional data in Magento 2 Mini Cart to show shipping charge, discount or tax information etc.
This is surely a blow to the user experience and needs a solution!
Here’s the programmatic solution to overcome this issue and update mini cart in Magento 2.
Method to update mini cart in Magento 2:
require([ 'Magento_Customer/js/customer-data' ], function (customerData) { var sections = ['cart']; customerData.invalidate(sections); customerData.reload(sections, true); });
That’s it.
Do share the solution with Magento community via social media.
Thank you.
Likewise in Magento 2 restrict quantity update from minicart which will be helpful to you when you have set condition of limiting the order quantity.