Setting up vat rates got me thinking about a way to get more out of the box for sites that need vat rates for European countries.
Most countries have two or three vat rates. These are determined by product, such as books, food, children's clothes, but it's not always possible to determine clear-cut logic for these, or at any rate, a clear-cut logic that matches up with how product types need to be sliced up for other reasons (such as fielding and filtering).
So what I propose is a module that provides:
- out of the box VAT tax rates for European countries
- a VAT rate reference field type that can be applied to products
- a single Rules component that applies that tax rate from the product to the line item.
Some more detail on how this would work:
- hook_commerce_tax_rate_info() defines tax rates. These should be bunched by country into .inc files, and loaded up according to an admin UI setting where the country whose vat applies is selected as a one-time setup option.
- in hook_commerce_tax_rate_info(), the 'rules_component' option is set to FALSE so a component is not created for every vat rate
- instead, hook_default_rules_configuration() defines a single component for vat calculation.
- the action for this looks at the tax rate field on the line item's product, loads the rate referenced there, and calls commerce_tax_rate_apply().
Comments
Comment #1
frost commentedA few thoughts from Ireland (land of 23% and 13.5% rates):
- first of all, great suggestion, espeically having a VAT rate reference field. It would address my current pain ;-)
- any thoughts on switching between VAT inclusive and VAT exclusive display / price input?
- we need to be sure that the VAT rate field is available when using FEEDS to import products
- when VAT rates change (our government in their wisdom recently increased our top rate from 21% to 23%), is the correct course of action to edit the rate or to add a new rate and disable (in whatever way appropriate) the old one? I'm thinking in particular of historical sales data where the old rate was used
- OOTB Country rates I would see as the least important part of this. As long as there is a UI for people to add/edit rates, I think that's ok. My accounts package required me to enter in Ireland's VAT rates the first time i used it, and each time my wise government changed the tax rates. As long as the UI is there i don't see a need to prepopulate these, which of course also requires keeping the list of rates and rules up to date -- if the rest of Europe is anything like Ireland, we'd have new releases every few months, when governments try to fix their economies by tinkering with rates!
Comment #2
dwkitchen commentedI have been working on a Commerce EU VAT module that would provide out of the box support for EU VAT rates.
I was originally going to use a taxonomy reference field on the product to link it to VAT rates but it could be done with a field directly referencing the tax rates. It needs to be possible to select a rate for each country enabled on each product.