Ignore a postcode tax zone that scores no match - #2684
Open
kha333n wants to merge 1 commit into
Open
Conversation
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.
Fixes #2683.
The same code is unchanged on
2.x, so this wants a forward port.A customer shipping to the UAE with postcode
SW1A 0AAis charged a Sheffieldrate, because the store happens to have a zone on
S1 2AB.The fix
$matchis the array['postcode' => …, 'matches' => 0], which is truthy evenwhen nothing matched — so the "give up" branch below it was unreachable. The
guard now reads the score inside it, which is the value that says whether the
zone applies at all.
Nothing else changes: the candidate query, the wildcard scoring and the sort are
all untouched, so a zone that does match still wins exactly as before.
Tests
tests/core/Unit/Actions/Taxes/GetTaxZonePostcodeTest.php:a single
S1 2ABzone, asked forSW1A 0AA. Fails on1.x, which returns theS1 2ABrow.character —
S1 2ABandSW*together;SW*still wins. Passes before andafter, and is the guard that the fix rejects non-matches rather than weakening
matching.