Shopware 6 and counting of VAT

Hello,

Can anyone explain how Shopware counts VAT in total price for Cart?

I have a cart with one product that costs 1.309 euro. Tax rate is 19%, so tax value is 0.24871. This I can understand: 1.309/100*19=0,24871.

But then it adds shipping cost (2 euro). It somehow makes 3.3074732824427 euro (don’t konow how), but even more strange for me that 19% from this amount makes 0.56871. How they are calculating this? 3.307/100*19 is about 0.63, and 3.307/119*19 is about 0.53, but not 0.57.

Also, is there any way to change this algorithm programmatically? I use in my Calculator $this->taxCalculator->calculateNetTaxes() for every product, but it doesn’t count total sum. And method $toCalculate->setPrice() in my CartProcessor doesn’t work.

no idea what you are calculating / how do you come up with those numers.
Let’s break it down:

cost of the product 1.309 net price
shipping costs 2.000 net or gross price (how did you set it up in your shipping matrix?)

shipping 2 net price:
1.309 + 2 = 3.309 + 19% = 3.9377

shipping 2 gross price
1.309 + 1.6807 = 2.9897 + 19% = 3.5577

crucial is setting up the tax (product, shipping & handling) for the various countries / states

no idea how do you come up with those numers.

It’s just what I’m trying to understand

Here is part of dump of total price:

 #calculatedTaxes: [Shopware\Core\Checkout\Cart\Tax\Struct\CalculatedTaxCollection](https://elbfood.yourwebstudio.ru/_profiler/open?file=vendor/shopware/platform/src/Core/Checkout/Cart/Tax/Struct/CalculatedTaxCollection.php&line=15#line15) {[#5617 ▼](https://elbfood.yourwebstudio.ru/checkout/confirm#sf-dump-1240599430-ref25617 "2 occurrences
[Ctrl+click] Expand all children") #elements: array:1 [▼ 19 =\> [Shopware\Core\Checkout\Cart\Tax\Struct\CalculatedTax](https://elbfood.yourwebstudio.ru/_profiler/open?file=vendor/shopware/platform/src/Core/Checkout/Cart/Tax/Struct/CalculatedTax.php&line=8#line8) {#5604 ▼ #tax: 0.56871 #taxRate: 19.0 #price: 3.3074732824427 #extensions: [] } ] #extensions: [] }

So, how 19% from 3.3074732824427 can equals 0.56871 ?

Now you can check your country VAT by click it.