I have create problematically adding number of products at a time in Magento 2 cart and there I can one see one first product in mini cart other products are also in mini-cart but not showing the count and price

here is the code that i tried to update mini-cart


<?xml version="1.0"?>
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Multiple_Addtocart" setup_version="2.1.1">


page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template" name="refresh.minicart" template="Multiple_Addtocart::refreshMinicart.phtml"  />


  ], function (customerData) {
    var sections = ['cart'];

But here i'm getting object not created error

enter image description here

  • have you added Magento_Customer in your module.xml as sequence? – chirag Sep 27 '17 at 6:22
  • @ chirag no how can i add this? checkout my updated code i have added my module.xml file – amith lal Sep 27 '17 at 6:32
  • check my answer – chirag Sep 27 '17 at 6:42
  • @ chirag got any idea? – amith lal Sep 27 '17 at 9:35

Please add sections.xml file under

etc -> fronted -> sections.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="checkout/cart/add">
       <section name="cart"/>

  • i have tried this code but no change please check my updated question with image – amith lal Sep 27 '17 at 4:35

Have you add Magento_Customer in your vendor/module/etc/module.xml?

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
   <module name="Vendor_Module" setup_version="1.0.0">
        <module name="Magento_Customer"/>  
  • in my question i have added the code app/code/Multiple/Addtocart/view/frontend/templates/refreshMinicart.phtml is there any change for this also is this require now? – amith lal Sep 27 '17 at 6:51
  • no changes, that is also required. is it working? – chirag Sep 27 '17 at 6:57
  • its not getting worked yet i dont know why my minicart not getting updated but in cart everything is ok is there any other way do you have any idea to update minicart or relod it the mini cart will only update when we change quantity or delete anything from minicart – amith lal Sep 27 '17 at 7:51
  • can you share your site url? – chirag Sep 27 '17 at 8:05
  • @ chirag dealer.xtrememats.desirewebbies.com/products.html – amith lal Sep 27 '17 at 8:24

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.