I created my custom module for add a product to my cart, if I use my controller with this form :

<form action="http://*********/mycart/cart/add/uenc/*******/product/1/" method="post">

My product is in my cart, but minicart is not update, and change page not resolve this problem.

But, if I change my form link with magento controller like this :

<form action="http://*********/checkout/cart/add/uenc/*******/product/1/" method="post">

It's work fine

In my controller, I have just change this

namespace Magento\Checkout\Controller\Cart

to this

namespace Test\Mycart\Controller\Cart;

1 Answer 1


Please try creating a sections.xml file in the etc folder of your module and configure it according to your needs For Example:

<action name="mycart/cart/add">
    <section name="cart"/>

This would reload customer's minicart on each POST request to your controller. Basically, action node indicates controller path and section node defines which client-side content should be updated.

Caches have to be flushed for this change to apply.

For a reference


Your Answer

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

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