VM not calcing taz correct with coupon

However, if a user uses a $100 overall coupon to make the subtotal be $59.50 the tax calculated at 7% by VM is $4.62 when 7% of $59.50 is actually $4.17.

Looking closer at this the $4.62 appears to be based on a sub of $66 rather than the $59.50 it should be. There is $7.50 somewhere that is part of the calc that is not showing. Or the tax rates is being increased somewhere.

It Calculates tax correctly without coupons.

Suggestions?

- Mike

seyi

2 years ago

0+0 / -0

Hello,

Are you using virtuemart calculation rule for tax per bill? If so please try this:https://awodev.com/forum/awocoupon/help-section/coupon-discount-amount-incorrect#comment-6926

I believe this is what is happening:

Your total discount is 100Your discount before tax is 93.46Your discount tax is 6.54

In the calculations your discount tax is being taxed and added to the total tax:4.165 + 6.54*.07 = 4.62

Regards

mbrando

2 years ago

0+0 / -0

Hello,

Your instructions say to look in /administrator/components/com_awocoupon/helpers/estore/virtuemart/couponhandler.php around line 384 for

Oh okay, I'm trying that one. It is around line 108 not 62. Trying now.

- Mike

mbrando

2 years ago

0+0 / -0

Hello,

With this change I made a test with 10% tax rate to make simple. Order sub total is 159.50 less $100 coupon makes $59.50 subtotal. Tax should be $5.95 but is coming out as $6.86. It is calculated tax based on $68.60 making for a $9.10 discrepancy in taxable fees.

- Mike

mbrando

2 years ago

0+0 / -0

Hello,

I did not realize that this was enabling a feature in the config area of AWO.

Now the big question. How do we do this using an override or method that will survive VM updates/patches?

- Mike

seyi

2 years ago

0+0 / -0

Hello,

Glad to see it is working well now.

There is no way I would override the calculationh class. That is at the heart of calculation of all prices/totals in Virtuemart. On an update you would simply go to awocoupon->installation check and reinstall the code. Granted it does not work now for vm 2.6.10 and up, but it will on the next release.

The above step in most cases will not be necessary as I would put in a fail safe to first check if the code is there, and if not install it before processing a coupon.

Regards

mbrando

2 years ago

0+0 / -0

Hello,

We are running VirtueMart 2.6.12.2 version.

Can you explain, "...I would put in a fail safe to first check if the code is there, and if not install it before processing a coupon."

How Can I automate this hack? Or have a notice sent if it does not exist?

- Mike

mbrando

2 years ago

0+0 / -0

Hello,

So there is no way to export that additional tax to a variable or to calculate the addition tax so it can be added back to the final fee in the coupon template or something?

- Mike

seyi

2 years ago

0+0 / -0

Basically if the injection does not exist and you have injection mode set to 'yes', then it will install it.

Regards

seyi

2 years ago

0+0 / -0

Yes, spent 2 frustrating days trying to figure out how to send in the tax to virtuemart so it all comes out correctly. Just did not work. The problem is virtuemart does multiple calculations on the data sent from coupons, starting somewhere around virtuemart version 2.0.24. Besides it is just not a clean solution sending in the wrong information so after Virtuemart calculates, the correct information can come back. The calculations could change at any time and would have to repreat the process.

Regards

mbrando

2 years ago

0+0 / -0

Hello,

>>Basically if the injection does not exist and >>you have injection mode set to 'yes', >>then it will install it.