Menu Close
    Hire us Request quote Reading list Switch to dark mode

    Update cart totals by js on checkout page magento2

    If you are working on checkout page functionality, and you are updating the totals by js. After this total is not reflecting/updating on summery block, then to update amount by JS after your request without reloading your page, you can use following process:

    you need to add following code in your js file:

    Here, firstly you need to define js

    after this create objects for the same, i used here defaultTotal and cartCache.

    Now, add these lines in your file after which you want to update the totals.

    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.

    Order total in default process:

    after executing code it will be like:

    Hope this will help you in manage totals of cart.


    Thank you.

    . . .


    Add Your Comment

    Be the first to comment.

    Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again