I tried updating the cart using JS and summary container is updating properly. But I want to update the quantity of the item. So basically I have added a custom button in checkout/cart page. When this button is click I add one product into the cart. Now this product is fix and the quantiity added per click is fix. Now everything is working just fine including the summary container. But I want to update the Quantity field in the form-cart container. But I don't know how to do that.
I found out that getTotalsAction contains the total that want but I don't know how to retrieve this result. I'm thinking of looping through the result to update the quantity value. How can I do this?
Note: I don't want a page refresh.
Below is my code
define([ 'jquery', 'Magento_Checkout/js/action/get-totals', 'Magento_Checkout/js/model/cart/cache', 'Magento_Checkout/js/model/cart/totals-processor/default', 'Magento_Checkout/js/model/quote', 'Magento_Customer/js/customer-data', 'jquery/ui' ], function ($, getTotalsAction, cartCache, totalsProcessor, quote, customerData) { 'use strict'; $.widget('mage.poundToCart', { _create: function () { this.processAddCart(); }, processAddCart: function(form) { formData = new FormData(form[0]); $.ajax({ url: form.attr('action'), data: formData, type: 'post', dataType: 'json', cache: false, contentType: false, processData: false, success: function (res) { var deferred = $.Deferred(); getTotalsAction([], deferred); // <--- I want to retrieve this value return false; } }); } }); How can I do this?
I tried this link but this does not apply in my situation as there is no validate response that I get. So I just want to refresh the cart form page like the image below
So basically I want to update the quantity field since adding the product is done via Ajax

