magento2: Cart shipping methods not updating when address changed

Preconditions

Magento develop branch

Steps to reproduce

  1. Install Magento from develop branch.
  2. Enable UPS shipping method via admin.
  3. Add an item to your cart from the store front end.
  4. Go to checkout.
  5. Shipping methods show “Sorry, no quotes are available for this order at this time”
  6. Enter an address.

Expected result

  1. The shipping methods should update and list rates for UPS.

Actual result

  1. Shipping methods still shows “Sorry, no quotes are available for this order at this time”
  2. This was working in 2.0.4, but seems to have broken in the develop branch.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

Anyone facing this issue - there is a workaround: https://github.com/magento/magento2/issues/5490 In brief, shipping methods don’t update when using one custom shipping method. If you add in a built in Magento method (eg Free Shipping for orders over a very large amount), then shipping methods update when address fields change.

I just tested the latest develop branch and this is still not fixed. It’s fixed specifically for the built in methods, like UPS. But for custom shipping methods (added via extension) it is still not triggering the update.

Timeline on getting a fix into a release? Causing issues for many SIs trying to push Magento2 live. It’s pretty fundamental that it does an ajax callback when the address changes.

For anyone finding this having trouble with a custom shipping method, it could be the wrong carrier code in checkout_index_index.xml. This sounds like the issue @mattf10 and @dwirt had above:

From the Magento doc: “You must add <your-validation-name> like %carrier%-rates-validation - where carrier has to match the actual carrier code.”

eg. we discovered the DHL Express Rates module has the carrier code ‘dhlexpress’, but in the XML, it had:

<item name="shipping-rates-validation" xsi:type="array">
    <item name="children" xsi:type="array">
        <item name="**dhl-express**-rates-validation" xsi:type="array">
            <item name="component" xsi:type="string">Dhl_ExpressRates/js/view/register-shipping-rates-validator</item>
        </item>
    </item>
</item>  

This validator was being removed, because the code ‘dhl-express’ was not the same as the carrier code ‘dhlexpress’. This happens in module-checkout/Block/Checkout/LayoutProcessor.php - it retrives a list of active carriers (where the config path carrier//active is set) and removes any validators whose code is not listed.

Hope this helps someone else… v1.0.3 of DHL Express is affected, I will submit a patch.

@ishakhsuvarov I had the same problem and this solves it, however there is a case where the shipping methods are not updated. In my case the carrier is dependent on postcode but if you enter a postcode that is not considered valid it will trigger the “Provided Zip/Postal Code seems to be invalid. Example: 12345. If you believe it is the right one you can ignore this notice.” warning and the shipping methods are then not updated.

bug shows as fixed in mainline. Trying to see if this will go with the next patch.