In checkout I have custom ajax request, script to remove a product in checkout. After that update cart section, all works, but I can't update cart qty title "1 item in cart".
How can I update it?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityIn checkout I have custom ajax request, script to remove a product in checkout. After that update cart section, all works, but I can't update cart qty title "1 item in cart".
How can I update it?
I finded solution.
- In my extension created file requirejs-config.js added code:
var config = {
config: { mixins: {
'Magento_Checkout/js/view/summary/cart-items': {
'Vendor_Module/js/view/summary/cart-items': true
}
}
}
};
- create mixin file located in Vendor_Module/js/view/summary/cart-items.js and changed function getItemsQty
define(
[
'ko',
'Magento_Checkout/js/model/totals',
'uiComponent',
'Magento_Checkout/js/model/step-navigator',
'Magento_Checkout/js/model/quote'
],
function (ko, totals, Component, stepNavigator, quote) {
'use strict';
var mixin = {
getItemsQty: function() {
var live_qty = parseInt(totals.getItems()().length, 10);
var qty = this.totals.items_qty;
if(live_qty != qty){
qty = live_qty;
}
return parseFloat(qty);
}
};
return function (target) {
return target.extend(mixin);
};
}
);
It works for me. Magento 2.1.6