Fixed
Project:
Commerce Core
Version:
3.x-dev
Component:
Tax
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Apr 2017 at 16:06 UTC
Updated:
23 Nov 2026 at 16:31 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
harings_rob commentedHere is what I know.
Example:
I have a Belgian e-commerce shop. I sell products with 21% vat.
A B2B customer from France with a valid vat number orders a product.
The product price is 121 euro including vat.
The products will be delivered to France.
Because of intra community supply, the vat (21%) does not have to be paid.
The customer pays 100 euro.
(https://ec.europa.eu/taxation_customs/business/vat/eu-vat-rules-topic/wh...)
I believe someone once informed me that the taxes are depending on where the goods are delivered/installed.
Comment #3
agoradesign commentedjust stumbled into this too
Comment #4
timlie commentedAllright, is this the reason why product prices with vat included don't get lowered (to price exclusive vat) when the Intra-Community-Supply scenario is applied?:
Subtotal 36,30 €
VAT 6,30 €
Total 36,30 €
becomes for a user from a different European country with valid tax number:
Subtotal 36,30 €
Intra-Community Supply 0,00 €
Total 36,30 €
When using product prices with vat excluded but showing the vat:
Subtotal 36,30 €
VAT 6,30 €
Total 36,30 €
becomes for a user from a different European country with valid tax number:
Subtotal 30,00 €
Intra-Community Supply 0,00 €
Total 30,00 €
I'm not sure if this should be lowered with store rate our customer rate, but the first example is definitely incorrect.
Comment #5
timlie commentedThe issue is not only present when there is the Intra-Community-Supply scenario.
Also when the VAT of another country (then the country of the store) needs te be applied. The VAT is calculated correct, but the unit price is untouched:
Example with products wit VAT included (21%) and a customer from Austria (VAT 20%) from where the store needs to apply the VAT rate.
Subtotal 24,20 €
VAT 4,03 €
Total 24,20 €
VAT is corrected to 20% but unit and total price stil show unit price with vat rate of 21%.
Comment #6
timlie commentedFor the record, asked my accountant. You always have to fallback to the price exclusive VAT. The price exclusive VAT of the shop zone. So for the Intra-Community Supply you have to reduce with the percentage of the store rate.
Comment #7
christophedg commentedSame problem here... Important issue to tackle for international webshops
Comment #8
stijndmd commentedDo we need to add a custom Resolver to do this, at the current moment?
Comment #9
nofue commentedThere is no reduction, you're thinking the wrong way.
Key to understand the concept of VAT is the net-value of any good or service. At the moment when the good is handed to the client, value added tax (hey, it's in the name!) is added. The point in time is usually neglectable, because VAT rates don't change that often, but it has to be considered for a perfect software.
Just to make it clear: You always sell products at their net value, and you add value added tax depending on the kind of goods or services, the location of delivery, and the status of the buyer, whether consumer or business holding a valid VAT-ID. If a business doesn't hold a valid VAT-ID, it is considered a consumer.
For the purpose of Drupal Commerce, these two rules have to be followed by the software:
When selling any goods or services within the country which issued the VAT-ID, value added tax has to be added.
When selling goods to consumers (also business without a valid VAT-ID) in or from any country within the EU, value added tax has to be added.
That's it. In this sense, VAT is pretty much the same as Sales Tax as known in other jurisdictions.
There are a lot of regulations, but nothing you can deal with from the perspective of Drupal Commerce.
Now the answer to your question should be obvious:
If a B2B sale happens across the borders of two EU countries and both parties hold a valid UID, no VAT has to be charged.
As this is still an exception of the general rule that VAT has to be charged on every trade of new goods and any services, you have to state on the invoice the "reverse charge has been applied, and the receiver of the goods will be responsible for paying VAT as appropriate".
That's it.
There is no such thing as "reducing the total price by any VAT rate", it's just answering the question: Has VAT to be added?
Comment #10
nofue commentedThis example is rather artificial, as you only have to charge customers a different rate when you hold a VAT-ID of the country you're delivering to.
However, your example of calculation shows how sick VAT is implemented in Drupal Commerce: Subtotal should ALWAYS be the sum of the net-values -- in your case of a 21% store € 20,-
Then the customer's VAT has to be charged, € 4,- when 20%, totalling a payment of 24,-
The problem should become obvious considering a low-VAT country, charging only 2%, trading with a high-VAT country, charging 32%:
If the store is located in the high-VAT country and net-value is € 100,-, the "subtotal" would be € 132,- and VAT shown for the low-VAT customer would be € 2,59 -- the seller will gain additional profits of 132-102,59 = 29,42
Even worse, selling from low-VAT to high-VAT countries:
The subtotal shown would be € 102,-, VAT would become € 24,73 -- the seller will lose(!) 22,73 Euros because he only collects VAT for the state and he is responsible to paying the collected VAT.
Done the right way: The net value will remain € 100,- in any scenario, but in high-VAT the client would be charged a total of € 132,- and in low
-VAT € 102,-
The whole VAT issue seems to escape most common people, especially programmers who haven't had any training in business. The general principle is quite simple and not different from any Sales Tax when we only look at the Drupal Commerce side of things:
Technically, there is a net value to which VALUE ADDED TAX gets added at the time of delivery.
The seller is just collecting VAT for the state he does business in, and he has to submit the collected VAT monthly (in general). The seller's profit must not change by charging VAT and because of MTIC, authorities became very sensible. Here's a good read (in German, other languages available): https://www.eca.europa.eu/Lists/ECADocuments/SR15_24/SR_VAT_FRAUD_DE.pdf
Comment #11
agoradesign commentedWhile it's probably not the best solution that the tax order processor checks for a plugin specific (EU VAT) source ID, this one-line patch solves the problem for us
Comment #12
matthiasm11 commentedThe patch from #11 contains a site specific machine name "euvat", which can be different depending on the site. (like in my case)
Looking into https://www.drupal.org/project/commerce/issues/2982355 to solve this issue.
Comment #13
matthiasm11 commented#2982355: Incorrect percentage discounts when prices are entered with tax, but displayed without (or vice-versa) should fix this.
Comment #14
alumni commentedGeneric solution with the VAT in this patch.
Comment #15
anybodyI'm not sure if that must be true, or should be decided by the shop owner.
Here's why:
When selling products to foreign countries and prices are entered vat-inclusive, you have a similar situation for the different VAT's and you want the total to stay the same, even if the vat rate changes! Otherwise you couldn't show the gross price without knowing the client's details (shipping location & vat id for example!)
So one could argue that it's luck or misfortune for the shop owner, because in each of this cases, the margin is different by design! Is there any law enforcement to reduce the gross amount for intra-community supply?
Comment #16
anybodyComment #17
alumni commentedI believe it’s important to clarify a key distinction between sites displaying tax-inclusive (TTC) prices and those displaying tax-exclusive (HT) prices.
1) For sites displaying tax-inclusive (TTC) prices:
The gross price (TTC) is entered including the local VAT rate (ex: 20% in France). When an intra-community B2B customer provides a valid VAT number, the VAT is simply removed (TTC price - local VAT), leaving the net price (HT). In this case, the shop owner’s margin is not impacted, as the net price (HT) remains constant.
However, for a B2C customer from another country (ex Belgium with 21% VAT), the gross price (TTC) must remain fixed, but the net price (HT) may vary depending on the VAT rate applied. This can slightly affect the margin, but this is required by law for B2C transactions to comply with EU Directive 2006/112/EC.
2) For sites displaying tax-exclusive (HT) prices:
The net price (HT) remains constant, and VAT is dynamically added based on the client’s location and VAT status. In this scenario, the shop owner’s margin is stable, as it is not affected by VAT rates.
This patch correctly adjusts the expected behavior by removing VAT for intra-community B2B sales with a valid VAT number, ensuring compliance with EU Directive. For B2C international sales, the margin variation is a consequence of the legal requirement to maintain a constant gross price (TTC).
I hope this explanation clarifies the distinction and why this behavior is necessary.
Comment #19
anybodyMoved #14 into a MR.
Comment #20
anybodyComment #21
anybodyI think we need tests for all these complex cases!
Comment #22
anybodyI reviewed MR !677 with the help of AI against 3.x (tested on 3.3.14, PHP 8.4, Drupal 11) and added kernel tests for it.
Is the expected behaviour correct?
TaxOrderProcessoralready does for exports outside the EU (the "don't overcharge a tax-exempt customer" logic). The customer rate does not matter here, because 0% applies.Review of the MR
…|ic|zeroadjustment lets the existing tax-inclusive reduction run, so 11.90 € (19% DE) becomes 10.00 € for a French B2B customer with a valid VAT number. Reduced rates are respected too, becauseStoreTax::getDefaultRates()uses the tax rate resolvers.Adjustment::getSourceId()can returnNULL, andsubstr_compare(NULL, …)triggers a deprecation notice on PHP 8.1+. I suggest!str_ends_with((string) $adjustment->getSourceId(), '|ic|zero')(PHP 8.1 is the minimum anyway) and a comment update.'|ic|zero'suffix ties the processor to the EU VAT plugin's zone and rate IDs. This is acceptable for now, but it could become a constant or a plugin method later.Tests added (
IntraCommunitySupplyTest, kernel)DE store, prices include tax, product variation priced at 11.90 €:
Without the fix, the three IC tests fail (11.90 € / 10.70 € is charged). With the fix, all 49
commerce_taxkernel tests pass, and phpcs (Drupal, DrupalPractice) is clean.Problems that already exist without this MR (follow-ups?)
display_inclusive = FALSE): no reduction happens, so the IC customer still pays 11.90 € net.StoreTax::getTaxTypes()only considers display-inclusive tax types, sogetDefaultRates()returns nothing. Exports outside the EU have the same problem. This is related to #2982355.OrderRefreshdoes not re-resolve overridden prices. This already affects exports, and the MR now extends it to IC orders. It probably deserves its own issue.I pushed the
str_ends_with()change and the tests to the MR. Please review.AI disclaimer: This review, the legal summary and the tests were prepared with the help of an AI assistant (Claude Code). I verified the results by running the tests locally. The legal notes are a summary, not legal advice.
Comment #23
anybodyComment #24
anybodyQuite a simple and logical fix, if I'm correct. @all here please review and check. Also please take a look at the both related issues, I think we should solve them in combination.
Thanks!
Test-only fails as expected.
Comment #25
jsacksick commentedComment #28
jsacksick commentedMerged and backported to 4.x!! Thank you