VAT tax rates are not calculating correctly when having multiple VAT tax rates.

To reproduce the bug, do the following steps:

  • Install Commerce Kickstart with products and product display nodes
  • Add tax rate ".10" of type VAT
  • Add tax rate ".20" of type VAT
  • Select .10 tax rate for PROD-01
  • Select .20 tax rate for PROD-02
  • Add PROD-01, PROD-02, PROD-03 products to your cart
  • Go to see your shopping cart

I expected product one to cost $10, product two $20 and product three $30. Instead I have, $12, $22, $39.60.

Screenshot of shopping cart contents

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iMiksu’s picture

Note that, when you remove the .20 rate and then select .10 rate for all products, you'll see all okay.

Screenshot

iler’s picture

I can confirm this bug. Also it should be noted that for the third product commerce also adds VAT even though it's not configured for it.

rszrama’s picture

Category: bug » support
Status: Active » Fixed

This actually is working as designed, though there's a related issue in the queue to consider changing the existing behavior.

When you select a VAT rate on the product form, you're saying the price of the product you've entered includes that VAT. It will always be present, bypassing any conditions you may place on the VAT rate's Rules. Still, any other VAT rate may also be applied because of the default Rules.

So, you said product one included the 10% rate already, so when the rule for the 20% rate executed you ended with a price of $10 (incl. 10% VAT) + the additional 20% VAT (i.e. $2) for a total of $12. Same for the $20 product, just in reverse. For the $30 product, you didn't enter the price including any VAT already, so both got added through the Rules for the total of $39.60.

What you could've done is simply disabled the default Rule that attempts to apply every VAT to every product on the site. Then only the VAT you select on product edit forms would've been taken into consideration. You just wouldn't be able to use any sort of conditional visibility on the rates.

I can't remember the precise other issues dealing with this issue, but if you search for issues including bojanz in the discussion, you'll find 'em.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

joachim’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Status: Closed (fixed) » Active

I think we still have a problem here.

When multiple VAT rates exist in the store, each product will still only get one applied.

Hence a store that requires multiple VAT rates (which in the UK is anything that sells children's clothes, so not that uncommon) will have to disable the 'apply VAT to everything' rule.

But then the price field UI is misleading, because you now MUST enter prices with the correct VAT rate included, otherwise the system won't work.

rszrama’s picture

Priority: Major » Normal
Status: Active » Closed (works as designed)

I'm quite sure this is still just the original limitation of entering product prices including VAT I mentioned above. If a store has multiple VAT rates and they want to include product prices including VAT, the answer is to do exactly as joachim described - disable the default Rule that attempts to apply tax rates generally. The default tax Rules in place are there as an abstract starting point to ensure taxes are at last being applied "in general", but the system should be tailored to meet a site's specific needs.

If a store has multiple VAT rates and doesn't want to enter prices including VAT, then you just need to add the appropriate conditions to the tax rate components so taxes only get applied where appropriate. I suppose you could use conditions to prevent multiple tax application even if you're entering product prices including VAT, but it seems it would be easier to just disable the default VAT rule in that case.

tahiticlic’s picture

Any clue on how to have a VAT rate depending on product type (or on a condition based on product fields) ?

This is a common need in many countries where there are multiple VAT rates I guess.

joachim’s picture

Component: Tax » Developer experience
Category: support » feature
Status: Closed (works as designed) » Active

> If a store has multiple VAT rates and they want to include product prices including VAT, the answer is to do exactly as joachim described - disable the default Rule that attempts to apply tax rates generally

This actually means that VAT support is not very good for a large number of countries that use VAT. Skim-reading http://en.wikipedia.org/wiki/VAT#Different_systems, most EU countries (apart from Denmark) have multiple rates.

Is this something that could be improved for subsequent releases of Commerce?

tahiticlic’s picture

Exactly, and the answer given is not an answer to the problem... Have no tax rules is not the same than to have a multiple tax rules.

[Edit] solved using Rules : http://vimeo.com/29725767

joachim’s picture

Category: feature » bug
Priority: Normal » Major

The more I think about it, the more I think that the default Rules configuration for VAT rate taxes that comes with Commerce is just not doing the right thing.

Currently, the way it works is that every vat rate tax gets a rule which applies the tax to every product in the cart. So given vat rates A and B, this happens:

* product X: +A, +B
* product Y: +A, +B

That's wrong for countries with multiple vat rates, or for stores that cover more than one country. The only case in which it works is if you have only one country and only one vat rate.

There's an extra bit of logic too. You can mark the product price as having vat already included. This is very handy for site owners, because they usually want to work in prices that include vat and let the system do the calculations.

But then this happens.

* product X, vat A already included: +B
* product Y: +A, +B

Rate B gets applies to product X!

The problem is that this logic is again only suited to single-rate sites. It's saying: "For each vat rate: apply the vat to each product, unless that product has this vat rate already included".

When what needs to happen is: "for each vat rate, apply the vat to each product **that it applies to**, unless that product has the vat rate already included.

In practical terms, I think we need to change the VAT price UI from this:

[price] [included vat rate]

to:

[price] [applicable vat rate] [x] included?

and then change the default rule so only one vat rate is applied per product.

This will satisfy countries with multiple vat rates, sites with multiple countries, and the currently working case of sites in countries with only one vat rate.

dwkitchen’s picture

I agree with rszrama this works as designed. If two VAT rate rule components evaluate as true for a product how could the main VAT rule decide which to apply?

However I do think there could be improvements to the admin UI for entering a product price and that is covered in other tickets.

tahiticlic’s picture

@joachim
You should check the video (http://vimeo.com/29725767), you'll see it is possible to use Rules in order to manage multiple tax rates. I've done this (French store, 2 tax rates) and it works perfectly well and elegantly.

For my own purpose, I've included a select field on product representing taxes, and the taxes rules components have conditions depending on this field.

giuvax’s picture

The video explains an unnecessary workaround (imho).
Why do I have to selected WHICH rate to apply to product if that selection doesn't affect ANYTHING?

Rather than adding a taxonomy and a rule, I think the solution is make available to rules the 'included tax' selection field. THAT field should already do what we need with multiple VAT rates.

Actually, disabling the VAT calculation rule DOES work, since it works as a precalculation rule. It works for me, since I want to show tax rates just at the end. But what if I had to show them on the product page?

askibinski’s picture

I agree that the current defaults are pretty confusing for someone who wants to setup a store with multiple VAT (very common here in Europe).

The confusing part is the main rule and the separate rule-components for each VAT, plus the fact you need to create a seperate field to select a VAT (if you don't want it to be included in the price)

After some googling, I also found this module.
http://drupal.org/project/commerce_eu_vat

Which actually creates a reference field and necessary taxes (for eacht EU country) and could be a solution.

nicjasno’s picture

I tried the EU VAT module, but it does not work as it should, sadly.

bojanz’s picture

commerce_eu_vat now has a 2.x branch based on http://drupal.org/project/commerce_vat.

And yes, the "include tax" dropdown is completely illogical and trips everyone up.

rszrama’s picture

Hmm, never tripped me up. : )

lmeurs’s picture

After disabling Commerce Tax and installing http://drupal.org/project/commerce_eu_vat and it's dependencies it all works great for me! I enabled it's Commerce EU VAT NL submodule that adds current Dutch VAT rates. The Commerce VAT Field submodule of Commerce VAT is a dependency of Commerce EU VAT which automatically adds a VAT field to product Commerce price fields, ie. at product variation edit pages.

Eventually we added some custom field formatters to present prices without VAT and format prices the way it suits our clients needs the best. So far so good!

Thanks all...

anrikun’s picture

Issue summary: View changes

I fully agree with joachim at #11: if I select VAT A to be included in a price, why should VAT B be added too afterwards. This doesn't make sense. Is there any country where several VATs exist for a same product?

rszrama’s picture

Please refer to my earlier comments; it doesn't make sense, and no one's saying it makes sense. It's just a matter of choosing a configuration that supports your desired VAT input method (i.e. disabling the default VAT related product pricing rule).

rszrama’s picture

Title: Prices are calculated incorrectly on multi VAT tax rate environment » Prices are calculated confusingly on multi VAT tax rate environment
Category: Bug report » Task
Priority: Major » Normal
Status: Active » Postponed

I'm marking this postponed until there's a clear way forward. To respond more appropriately to comment 21, you just need to complete your configuration of Drupal Commerce VAT. It doesn't work correctly out of the box for every situation - it just makes a very generic assumption because a more specific one isn't possible in the abstract. You can disable the default pricing rule that applies VAT or add conditions to the individual VAT rate rules components that govern their applicability. Whatever strategy you want depends on your store's configuration, but there's no bug in the way this is currently functioning.

Ultimately, we just need a way to clarify the situation. I'm open to more suitable default behaviors, but about the only alternative I can imagine is to not create a default rule to apply VAT to products - which we all know would just fill up the issue queue with "I added VAT but it's not applying to anything" issues. : )

giuvax’s picture

I'm sorry, but I haven't access anymore to that drupal installation, so I have to create another one to test it. It may take some time.

etron770’s picture

I was also completely lost,
I am using a kickstart installation choosing the VAT option and adding prices including VAT to products
All is working fine including f.e delivery without taxes.
But the cart is completely wrong when I add a second vat .

after trying to change the rules for taxes I was on
admin/commerce/config/product-pricing and disabled the rule
Calculate taxes for: VAT to see how the cart is working

and ... all is working fine .. but I am still lost to explain why

GDuser’s picture

We are (date 2015) implementing Drupal Commerce in our company (Europe) and we discover this issue of multiple tax rates as well. If I had knew that Drupal didn't manage this I'd not have choosen for this solution, really. That's a main issue. I understand other countries doesn't work like Europe but saying that this is the designed flow doesn't help us further. We are now trying to fix with a workarround (rules ...) but I'd like to know if there's another way to have this work normally (like any other eCommerce solution...). I've tried out #25 but it doesn't work.
We are selling books (rate 6%) and digital products (21%).
To contribute in order to find a clear way forward (for Europe):
A product has at least one tax rate (can be 0%, 6% , 21%, etc...)
but if it is a combined product than it can have 2 rates.
Example : A product (€ 15,-) = A paper book (€ 10,-)with a digital Add-on (€ 5,-)
The applied rates are 6% on € 10,- and 21% on € 5,-

We can have in a shopping cart
Product X1 10,- rate 6%
Product X2 20,- rate 21%
product X3 30,- rate 0%
product X4 40,- -> 30,- at rate 6% and 10,- at rate 21%

To notice that the combined taxe rate is (at my knwoledge) only applied in Belgium and The Netherlands but with digital products it's possible that this rule will be applied on the rest of Europe.
In none of al those mentionned cases above there's a double application of taxes. That doesn't exist in Europe.
I hope this will help to find a simple final solution for this issue.

rszrama’s picture

Well, what you really have is an issue requiring two line items, so it's not that Drupal Commerce doesn't support taxes appropriately but that the attribute system isn't going to support split taxes in a single product line item. You basically need to use Commerce Product Add On or Commerce Bundle to manage bundling the digital product in this scenario, and then their respective tax rates will apply just fine.

bojanz’s picture

Status: Postponed » Closed (won't fix)

We wrote a saner tax implementation in 8.x-2.x. The 7.x-1.x version is set in stone, we can't rewrite it at this point.

Sorry, everyone.