2

How can I update the grand total value when shipping method is changed to reflect new calculation?

When you change the shipping method here,

It must reflect the new calculation in TOTAL section.

4
  • you mean to say right part of checkout page? Commented Jan 6, 2017 at 5:40
  • Yes that is correct, the summary section.
    – nuwaus
    Commented 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. Commented Jan 6, 2017 at 5:43
  • Did you got any solution?
    – konika
    Commented Feb 10, 2017 at 14:05

1 Answer 1

4

I have the solution First of I found its easier to copy all the files into my theme directory.

  1. Create the theme directory

    http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/theme-create.html

  2. Overwrite Checkout pages

    app/design/frontend/[Vendor]/[Theme]/Magento_Checkout/
    
  3. Copy web folder from default theme to your Magento_Checkout

    vendor/magento/module-checkout/view/frontend/Magento_Checkout/web
    
  4. Edit Magento_Checkout/web/template/summary/ (totals & grand-total) remove code below from both files.

    <!-- ko if: isDisplayed() -->
    <!-- /ko -->
    
  5. 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;
    },
    
  6. Run following commands

    php bin/magento setup:static-content:deploy
    php bin/magento indexer:reindex 
    php bin/magento cache:flush
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.