What could cause the installation of most payment-related modules lead to VAT being calculated twice?
-
12-12-2019 - |
Question
This is a problem we have been experiencing with the websites of two of our clients for a very long time. Almost every single time we install a module that is in some way related to payment functionality, VAT is calculated twice. This leads to a lengthy process of having a support team fix it and extensive testing, and them ultimately also not knowing exactly where the issue had originated from. Because this costs a lot of time, we are prioritising finding out where this problem is originating from right now.
We have gone over all the system settings and have tried out numerous of combinations, spent hours in total debugging code and scouring Google, but to no avail. We're just finding it very odd that it happens with almost every payment-related module, so there must be a common point where things turn bad.
Could anybody point us into the right direction?
Thanks a lot in advance.
Solution
One reason why things may get added twice is that the totals collection process is run through once for every address attached to the quote.
Some extensions fail to distinguish between the billing and the shipping address. I have seen this often.
Even if many extensions recognize that some of them may fail if you have multiple shipping addresses.
OTHER TIPS
There is a method \Mage_Sales_Model_Quote::collectTotals
which does afaik all the calculation, including tax. To speed this up (I think) they save a lot of values in some cached.
If you call the method a second time, all the calculation is crushed. This might be a starting point.