[4.x]: Tax removal on order level broken
What happened?
Description
On an order when you have a valid EU vat-id the tax doesn't get removed on order level because it gets removed by the discount logic.
Steps to reproduce
- Tax zone "EU"
- Country: Belgium
- Tax Rates "Eu"
- Taxable subject: Order total taxable price
- Tax Zone: EU
- Disqualify with valid business tax ID?: EU VAT ID checked
- Rate: 21%
- Included in price?: checked
- Adjust price when included rate is disqualified?: false
- Remove the included tax when a valid EU VAT ID is present?: true
- Create an order with Belgium as country and have a valid "Organization Tax ID"
Expected behavior
Negative tax applied on order level
Actual behavior
Tax line just removed https://github.com/craftcms/commerce/blob/develop/src/adjusters/Discount.php#L139
Solution?
- Why isn't it a negative "tax" adjustment instead of a "discount"? Makes also the
getTotalTax() / getTotalTaxIncluded()andgetTotalDiscount()more logical in its values. - Actually all discount adjusters on order level are broken
Craft CMS version
4.7.3
Craft Commerce version
4.4.1.1
PHP version
8.3.2
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
No response
Related to this: The EU Tax rate handling here https://github.com/craftcms/commerce/blob/b15927514d794064e0c09a547285668a50a6089f/src/adjusters/Tax.php#L326-L353 is incomplete. You are only allowed to remove the VAT when the customer is in another EU country. E.g. When the shop country is Belgium and the customer country is France and the customer provided a valid EU Vat ID then the VAT can be removed. When the customer's country is Belgium, too, the VAT cannot be removed.
Anyway, it would also be good to know if Commerce has removed the VAT because then we are required to notify the customer that it is her/his responsibility to pay the VAT with the reverse charge mechanism ( see https://taxation-customs.ec.europa.eu/vat-invoicing-rules_en#:~:text=Customer%20liable%20for%20the%20tax%20(i.e.%20under%20the%20reverse%2Dcharge%20procedure)%20%E2%80%93%20the%20words%20%E2%80%98Reverse%20charge%E2%80%99. )