Magento 2 Checkout Shipping Methods Refresh

Magento will automatically refresh the shipping methods on the checkout when a part of the address changes.  I thought that this functionality was separate from code related to individual shipping methods, but when I disabled all of the out of the box methods, and enabled my custom method, that functionality went away.

This functionality is driven by the “shipping-rates-validation” javascript.  You will need entries in:

  • frontend/layout/checkout_cart_index.xml
    frontend/layout/checkout_index_index.xml

And then the corresponding javascript in 3 separate files (per shipping method):

  • web/js/model/shipping-rates-validation-rules/method_name.js
  • web/js/model/shipping-rates-validator/method_name.js
  • web/js/model/shipping-rates-validation/method_name.js

Leave a Reply

Your email address will not be published. Required fields are marked *