Jump to content

Need to overhaul how tax included vouchers are calculated


Matt E

Recommended Posts

Hello,

I only recently discovered this and I'm surprised there isn't more discussion around it. Right now when a "tax included" voucher is applied to cart, the reduction_amount is split into 2 pieces: product and tax. For example, a $500 tax included voucher applied to an order with an 11.11% tax rate would actually show a $450 discount to products, and reduce the original tax amount by $50 (with no visual explanation).

To a customer this is very confusing, because they enter a $500 discount code and only see -$450 discount, they are not aware the tax is now also $50 less unless they are paying very close attention.

This also causes problems in back office, especially when voucher total is higher than order total. When that happens, if say the order was $100 + $11.11 tax, the customer would be charged $0, so order is "free", back office shows $0 tax, and no entry is recorded to the order_tax table. The only record of tax is when the new voucher is created, it's value is $388.89. This means the tax rules applied to that order cannot be retrieved from order history, it doesn't even show up anywhere in back office. Only by comparing old vs new voucher total can you see the difference!

First, I tried changing how it appears on front end by recalculating the $cart Smarty object elements from hookHeader() with a custom module, but this only does cosmetic change on cart/checkout pages -- the database is still missing all that information.

So it seems the only way to fully fix it is to fundamentally change how Prestashop handles vouchers at its core. I made a quick comparison showing before/after my changes (see attachment with notes), but now I want to make this the default behavior for all tax included vouchers. Can someone with more experience advise the best way to achieve this? Specifically, which files/classes/controllers are responsible, and what functions to override?

Thanks,

 

PS-Voucher-Tax-Cart-Before-After.jpg

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...