fix: PayPal Express rule-based shipping methods not switched on country changed#664
Open
Chuc Le (untilu29) wants to merge 1 commit into
Open
fix: PayPal Express rule-based shipping methods not switched on country changed#664Chuc Le (untilu29) wants to merge 1 commit into
Chuc Le (untilu29) wants to merge 1 commit into
Conversation
9c8b60c to
2b44131
Compare
Fabian Boensch (En0Ma1259)
approved these changes
May 12, 2026
Contributor
|
Not sure if we need this whole Shipping name fallback. AFAIK this was a Sandbox fluke a few days ago and not really something we should expect. |
2b44131 to
2f3d3c2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Why is this change necessary?
When the buyer changes the delivery country in the PayPal Express popup, the shipping callback switched the sales channel context to the new country but kept the previously selected shipping method ID. If that method was restricted by a country rule, the cart picked up a ShippingMethodBlockedError and the callback hard-failed with
EXPRESS_SHIPPING_CALLBACK_METHOD_UNAVAILABLE- even when another shipping method was available for the new country2. What does this change do, exactly?
After the context switch, if the cart now has a ShippingMethodBlockedError and ShippingOptionsProvider returns an available alternative, switch the context to the first available method and recalculate the cart so PayPal sees a valid selection
Also guard ExpressCustomerService::getAddressData against Shipping::$name being uninitialized — PayPal occasionally returns a Shipping struct without a name (e.g., in local-development mode), which caused a TypeError on the typed property access
3. Describe each step to reproduce the issue or behaviour.
4. Please link to the relevant issues (if any).
5. Checklist