How to Update Mini Cart in Magento2 ?

  • author-img Nidhi Arora
  • 4 years
How to Update Mini Cart Magento2

Update mini cart when you are submitting a form

Magento provides a way to update minicart if you are submitting a form. First of all create sections.xml file in ‘etc/frontend’ folder in your module.

Now write following code snippet in sections.xml file

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Customer:etc/sections.xsd">
<action name="modulename/controller/addProduct">
<section name="cart"/>

Action name: action name is controller where you are submitting form.

Example of this situation may be when you want to set custom price of product in your own controller. This approach will work when you are using POST or PUT form submitting. It will also work for AJAX request.

If you still have any query regarding this “How to” or would like to add some suggestions to this solution, let us know your feedback or query at [email protected], and don’t forget to share this “How to” blog with your fellow Magento 2 users!

Download Blog


Ready to Get started

Communication is the key for us to understand each other. Allow us to understand
your requirements or queries. Present us with an opportunity to serve you.

Fill out the form and out team will get back to you
within 24 hours

    Head Office

    1250 Pittsford Victor Road Ste 310
    Pittsford, NY 14534

    Development Center

    Plot no. 10, Rajiv Gandhi
    Chandigarh Technology Park