verbb / postie

A Craft Commerce shipping calculator plugin.
Other
12 stars 18 forks source link

Cart shipping method not being changed when changing shipping address #140

Open peteeveleigh opened 2 months ago

peteeveleigh commented 2 months ago

Describe the bug

A customer sets a shipping address, then proceeds to choose a shipping method. Both are set on the cart. They then backtrack through the checkout and change their shipping address. The new address results in the original selected shipping method being invalid but it is not removed from the cart.

The standard Commerce behaviour would be to remove the selected invalid shipping method from the cart and instead apply the first valid one available for the new shipping address.

Steps to reproduce

  1. Set up shipping options specific to different regions; e.g. USA and Canada
  2. Checkout and set the shipping address to, say, USA
  3. Select the USA specific shipping method offered
  4. Go back and update the shipping address to a Canadian address
  5. Examine the shipping method on the cart, it will still be the USA specific method.

Craft CMS version

4.10.4

Plugin version

3.1.8

Multi-site?

No

Additional context

No response

sjcallender commented 2 months ago

Also, we started support with Craft, but confirmed it's a Postie issue.

@peteeveleigh disabled Postie, then set up a single shipping method with 3 different rules for US, Canada, International. When he changed the shipping address on the front-end, the shipping rate also changed (because the selected shipping method changed by default).

peteeveleigh commented 2 months ago

Also just confirmed what happens in the CP when using Postie. If I change the shipping address on the cart in the CP then the original option is greyed out and when I click "Update Order" the first valid shipping method is set on the cart.

So what could be different about doing it on the front end via the update-cart controller?

engram-design commented 2 months ago

Do you have manualFetchRates enabled? I'm not seeing this behaviour. Rates and their shipping methods are cached based on their cart content and the customer address, so if that changes, new shipping methods are then available.

If the previously-selected shipping method still exists for the new address, but a different price, then nothing will change (apart from the shipping cost, already applied to the order of course), but if the shipping method (the specific service for the provider) is no longer available, the shipping method with in invalidated.

peteeveleigh commented 2 months ago

@engram-design No, manualFetchRates is not enabled. It's not defined in our config at all.