Magento is one of made for E-commerce CMS that knows for its functionality, flexible code structure and performance. Among that, Magento comes with an Enhanced shopping cart features as well as a mini shopping cart widget that appears in the upper-right corner of the store. Using this mini cart customer can quickly take a look at cart items and can update or reduce product quantity. Generally, when you add any products to cart it will be automatically listed on the cart page as well as widget page. But in a recent version of Magento 2.1.x, there is an issue while we add products to cart and click view cart option it shows that cart is empty. However, it shows a successful message instantly. Even this issue is raised by one of the developers in Magento Github.

After working on this issue for a while, finally we found a solution by overriding ‘sections.xml’ file on store frontend using a custom extension. Simply create a file using following code inside your extension folder.

In this action parameter name, you have to pass the full action (For ex. checkout/cart/add ) in which cart is updated. It means you programmatically delete or add a product to cart to the shopping cart.

Lastly, Comment down below if you face any issue while using this code.

Happy Coding!

Click to rate this post!
[Total: 25 Average: 4]