I am using Magento2.1.9 when I am going to the checkout page, order summary reloaded default magento's way so I used a js to our custom module added below code into it
var deferred = $.Deferred();
getTotalsAction([], deferred);
After that applied all commands but not working in reload order summary if any one idea reply me I have try to in other stack solution regarding this but not getting success.
1 Answer 1
I used one of the very good tutorial for this purpose
you need to add following code in your js file
/*browser:true*/
/*global define*/
define(
[
'ko',
'jquery',
'Magento_Checkout/js/model/cart/totals-processor/default',
'Magento_Checkout/js/model/cart/cache'
],
function (ko, ,ドル defaultTotal, cartCache) {
'use strict';
return Component.extend({
updateamount:function () {//your function to update amount
//your code to update amount
//after successfull execution you need to add these lines.
cartCache.set('totals',null);
defaultTotal.estimateTotals();
}
});
}
);
cartCache.set(‘totals’, null) : set the cart total to calculate totals again, if not using this line then estimateTotals() returns the totals for cache.
defaultTotal.estimateTotals(): executing the process to calculate totals.
Reference: https://webkul.com/blog/update-cart-totals-by-js-on-checkout-page-magento2/
I hope this will help
-
where is this js put it in our custom module js or other custom js createRv Singh– Rv Singh2019年03月13日 10:25:11 +00:00Commented Mar 13, 2019 at 10:25
-
in checkout i used custom fee module and this module call two js one for cart and other is summary jsRv Singh– Rv Singh2019年03月13日 10:25:52 +00:00Commented Mar 13, 2019 at 10:25
-
I have to use this code but my layout mess up so if u suggest another way.in console getting js errorRv Singh– Rv Singh2019年03月13日 14:20:52 +00:00Commented Mar 13, 2019 at 14:20
-
In console getting error my checkout page layout mismatchRv Singh– Rv Singh2019年03月14日 06:04:51 +00:00Commented Mar 14, 2019 at 6:04