Auto-recalculate shipping when the address changes

Created on 4 February 2017, about 8 years ago
Updated 18 December 2024, 4 months ago

Right now people need to click "Recalculate shipping" at checkout when they change the address, to refresh the form.
That should be done automatically like in 1.x.

1) Hide the button.
This should do the trick:

  '#attributes' => [
      'class' => ['js-hide'],
  ],

2) When the address changes (no clue which JS event to use, check 1.x), check that the address is complete, and if it is, click the button.

Notes;
1) The address is complete if all of its required fields are filled.
2) Once the field is complete, we only need to recalculate if one of these fields changed: dependent_locality, locality, postal_code, administrative_area.
We don't care about the name, organization, address lines.

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇷🇸Serbia bojanz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇷🇴Romania beniamin.szabo

    The automactic recalculation is not triggered when selecting a profile from the addressbook.

  • We still struggle with this issue as it seems others do (#203). For now I added an OrderProcessor with a higher priority than the EarlyOrderProcessor and force a refresh with:

        if ($this->shippingOrderManager->hasShipments($order)) {
          $order->setData(ShippingOrderManagerInterface::FORCE_REFRESH, TRUE);
        }
    

    Anyone else troubled? Probably self-imposed . 🙈

  • The problem still exist in 8.x-2.x-dev , 14 Feb 2025.
    Patch #185 faild.
    Is there a new updated patch?

Production build 0.71.5 2024