I am working on ajax cart. When i update the cart qty, I am trying to reload the quote but its not loading properly


How to reload the quote so that total calculation should happen properly in magento1 we use cart::init()

  • 1
    did you get any success on this? Nov 3, 2016 at 12:22
  • did you get any success on this? i am getting same problem Feb 15, 2018 at 8:42

2 Answers 2


I hope this may helps you

After add to cart run this code:

use Magento\Framework\Session\SessionManagerInterface;
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
use Magento\Framework\Stdlib\Cookie\PublicCookieMetadata;
use Magento\Framework\Stdlib\CookieManagerInterface;

in constructor:

    CookieManagerInterface $cookieManager,
    CookieMetadataFactory $cookieMetadataFactory,
    SessionManagerInterface $sessionManager,

After product was added to cart

$metadata = $this->_cookieMetadataFactory

$sectiondata = json_decode($this->_cookieManager->getCookie('section_data_ids'));

$sectiondata->cart += 1000;


Before trying above code try with frontend/section.xml :

     <section name="cart"/>

You can do this in Your JS

like this

], function($,customerData){
    return function (config){
        var ajaxUrl = config.ajaxUrl;
        $("#addtoCart").on("click",function (event){
            let param = {
                Sku : $("#productSku").val()
                showLoader: true,
                url: ajaxUrl,
                data: param,
                type: "POST"
            }).done(function (data) {
                // you can add more section with comma seprated
                let cartSection = ['cart'];
                // if you want to invalidate previous data
                //Reload Secion
                customerData.reload(cartSection, true);

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.