Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
I originally thought this was similar to #3207548: Recalculate shipping methods when manually creating a shipment in the backend, but that's a feature request. Shipping recalculation on the admin shipment form does not take the currently selected shipping profile and shipping rates aren't valid or returned at all.
Steps to reproduce
Edit an order for a customer that has multiple shipping profiles. Attempt to select a different profile and recalculate shipping. When the shipping rates plugin gets the shipment object, the profile value is empty or incorrect.
Proposed resolution
Review the patch and suggest how this should be handled.
Comment | File | Size | Author |
---|---|---|---|
#6 | interdiff_5-6.txt | 630 bytes | jsacksick |
#6 | 3242737-6.patch | 4.5 KB | jsacksick |
|
Comments
Comment #2
andyg5000I'm also noticing that with the patch above that fixes my issue... When I click recalculate multiple times, the profile id is removed from the widget and replaced with _original. The widget then defaults back to the first profile since the selected profile id is no longer an option.
Comment #3
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedComment #4
jsacksick CreditAttribution: jsacksick at Centarro commentedSeems to work much better with the attached patch!
It actually fixes several bugs, manage to get an "Illegal choice detected" error when entering a new address, and then selecting a different profile.
This kind of shows that we have insufficient tests coverage.
But, before the pach, wasn't getting updated rates, now I'm am. Also backported a fix that was applied to the shipping info pane. (Selecting a different address now refreshes the rate without having to click on "Recalculate shipping", this is probably related to #3207548: Recalculate shipping methods when manually creating a shipment in the backend.
Comment #5
jsacksick CreditAttribution: jsacksick at Centarro commentedOk, after switching profiles back and forth, switching between a profile and entering a new address, realized the rates sticked when they shouldn't.
That is because, we don't update the address if it's NULL, but I think we should.
Comment #6
jsacksick CreditAttribution: jsacksick at Centarro commentedThe patch from #5 introduced a regression (when the "_original" option is selected), the attached patch is fixing that while preserving the fix introduced in #5 as well.
Comment #8
jsacksick CreditAttribution: jsacksick at Centarro commentedWent ahead and committed the fix.
Comment #10
jsacksick CreditAttribution: jsacksick at Centarro commentedIt's still not "perfect" as filling all the required fields of an address doesn't trigger a recalculation, but that should happen in a followup.