Hi !
I need a little help
I have create a custom module and with this module, I add a product to my cart with no problem.
But, impossible to update my minicart in header
I have my product to my cart, but my minicart is always empty...
Anybody have a idea to help me ?
Solved! Go to Solution.
Find myself
did you customised the minicart ?
No, this is the default minicart
Hi,
Have you found the issue with this, i have the same problem
Thanks
can you please share how you fixed this?
Hi Could you please let me know how to add product to cart programatically?
what did you find?
There are two day to that first is js
require(['jquery','Magento_Customer/js/customer-data'], function ($,customerData) { var sections = ['cart']; customerData.invalidate(sections); customerData.reload(sections, true); });
Second this using the section.xml
NameSpace/ModuleName/etc/frontend/section.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Customer:etc/sections.xsd"> <action name="frontname/controller/action"> <section name="cart"/> </action> </config>