3

I have the following XML file sections.xml at the following path:

Magento2Dir/app/code/vendor/module/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="customproduct/manage/add">
        <section name="cart" />
    </action>
</config>

I have a bit of code on a page which sends the product ids and quantities to a controller which adds the product to the cart (the products do get added to the cart).

This does not update the mini-cart. If I add another product using the method for default products (Standard add to cart) then it works and the mini-cart is updated.

What is the minimum I require for the mini-cart to load changes?

Including via AJAX

0

Create a new file in ModuleName/etc/frontend sections.xml your miniCart will Update.

2
  • <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Customer:etc/sections.xsd"> <action name="ModuleName/customer/addtocart"> <section name="cart"/> </action> </config> – Saurabh Taletiya Oct 18 '16 at 10:26
  • Isn't that exactly what I already have? – LM_Fielding Oct 18 '16 at 10:53
0

The reason for this is that I was hitting it with an ajax request to a relative url - the section will only update in version 2.1.4 if an absolute url is used.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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