Make cart taxes configurable via Spree::Store object#933
Merged
gmacdougall merged 8 commits intomasterfrom Mar 16, 2016
unknown repository
Merged
Make cart taxes configurable via Spree::Store object#933gmacdougall merged 8 commits intomasterfrom unknown repository
Spree::Store object#933gmacdougall merged 8 commits intomasterfrom
unknown repository
Conversation
There was a problem hiding this comment.
Space inside { missing.
Space inside } missing.
Spree::Store object
Contributor
Author
|
Added changelog entry, rebased on current master. Ready for review! |
Contributor
Author
There was a problem hiding this comment.
I thought because of the multiline expression. But - having written code that doesn't need it, I guess it can go here as well.
This class is intended to behave like an address when passed into Spree::Zone.for_address, but not have any of the complex behaviour of Spree::Address.
This scope finds all relevant tax rates for an address in one SQL query.
Instead of setting instance-wide whether orders in cart state should be taxes using some default country, this lays the groundwork for making that setting only store-wide.
In order to configure how each store within the same Solidus instance handles a cart without a tax address, this method uses the `cart_tax_country_iso` setting to create a Spree::Tax::TaxLocation with that country.
Yet another step in removing the default tax zone: When the order does not have a tax_address, refer to the store's default cart tax location. This required quite a few spec setup tweaks as it's the first time I'm actually using the mandatory store on an order, , but nothing grave.
This configuration setting, which is valid for the entire Solidus store instance, will tell Solidus which VATs are included in prices entered in the backend. I am splitting up the meaning of Spree::Zone.default_tax here, because that setting conflates two questions: 1. Are we entering backend prices including VAT? 2. Should carts without a tax address be taxed? The second setting should be `Spree::Store`-specific.
The current default behaviour in Solidus is one setting for two behaviour changes: What taxes are included in the prices in the backend, and how carts without a shipping address are taxed. While doing the work in separating the two settings, it does make sense for most shops to have both be equal. This just sets the `cart_tax_country_iso` for a new store to be equal to the Spree::Config for the backend prices.
Contributor
|
Looks reasonable to me 👍 |
Member
|
👍 |
gmacdougall
added a commit
that referenced
this pull request
Mar 16, 2016
Make cart taxes configurable via `Spree::Store` object
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.
In VAT countries, carts (orders without addresses) have to be shown with
adjustments for the country whose taxes the cart's prices supposedly include.
This might differ from
Spree::StoretoSpree::Store. We're introductingthe
cart_tax_country_isosetting on Spree::Store for this purpose.Previously the setting for what country any prices include
Spree::Zone.default_tax. That, however, would also implicitly tag all
prices in Spree as including the taxes from that zone. Introducing the cart
tax setting on Spree::Store relieves that boolean of some of its
responsibilities.
This PR also introduces the
Spree::TaxRate.for_addressscope. It's not fully being used here yet, but that's coming up later.