Magento 2: How to Change Grand Total on Shopping Cart Page

grand-totalknockoutjsmagento2shopping-cart

I want to change grand total i.e of on shopping cart page.
I don't want to show any shipping or taxation on cart page all must be on checkout page only.

I tried with changing vendor\magento\module-checkout\view\frontend\web\js\model\totals.js like

if(i == 4){
    this.totals().total_segments[i].value = this.totals().total_segments[0].value;
    var total = this.totals().total_segments[i];
}

and it works for me but if I made any changes in it then it will reflect on chcekout page also I want it on shopping cart page only.

Can any one please suggest how can I achieve this.

Best Answer

Cart summary on Cart page also used the Ui component. So, we can replace the default with your custom js component. Take a look at the Tax xml layout, we can see some good examples here: vendor/magento/module-tax/view/frontend/layout/checkout_cart_index.xml

Related Topic