How can I update the grand total value when shipping method is changed to reflect new calculation?
-
you mean to say right part of checkout page?– Dhiren VasoyaCommented Jan 6, 2017 at 5:40
-
Yes that is correct, the summary section.– nuwausCommented Jan 6, 2017 at 5:41
-
Either you need to create a custom extension of change in default magento files, and make custom code to do this things.– Dhiren VasoyaCommented Jan 6, 2017 at 5:43
-
Did you got any solution?– konikaCommented Feb 10, 2017 at 14:05
1 Answer
I have the solution First of I found its easier to copy all the files into my theme directory.
Create the theme directory
http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/theme-create.html
Overwrite Checkout pages
app/design/frontend/[Vendor]/[Theme]/Magento_Checkout/
Copy web folder from default theme to your Magento_Checkout
vendor/magento/module-checkout/view/frontend/Magento_Checkout/web
Edit
Magento_Checkout/web/template/summary/
(totals & grand-total) remove code below from both files.<!-- ko if: isDisplayed() --> <!-- /ko -->
Edit
Magento_Checkout/web/js/view/shipping.js
Find selectShippingMethod Function line 215 and add
setShippingInformationAction();
Should look like this
selectShippingMethod: function (shippingMethod) { selectShippingMethodAction(shippingMethod); checkoutData.setSelectedShippingRate(shippingMethod.carrier_code + '_' + shippingMethod.method_code); setShippingInformationAction(); return true; },
Run following commands
php bin/magento setup:static-content:deploy php bin/magento indexer:reindex php bin/magento cache:flush