Add a default tax address preference #851
Closed
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.
The current
default_tax_zone
system is flawed: It conflates tax andshipping zones (Spree::Order#tax_zone can return a shipping zone if that
happens to be smaller than the smalles matching tax zone), and it creates
a large number of complex queries that won't be necessary once we start
finding tax rates by the order's tax address.
However, the default tax zone was good for one thing: Tell the system which
taxes to use for orders in cart state (before any addresses are entered).
This commit introduces a default tax address preference, defaulting to an
address with the default country as country. The object is also frozen so
the taxation system doesn't go on building many useless objects.
This PR should also ease @jhawthorns concerns about using the same preference for the default country being used for taxation purposes: If you want to override it, specify a different default tax address.