wagnerwagner / merx

Merx is a plugin to create online shops with Kirby.
https://merx.wagnerwagner.de
104 stars 10 forks source link

$cart->getSum() includes tax? #45

Closed jacoblindgren closed 2 years ago

jacoblindgren commented 2 years ago

Hi there, thanks for the incredible plugin. Is $cart->getSum() meant to return the total price of all the products in the cart "including tax" as the documentation suggests? For me it excludes tax (with cart()->getTax() returning a dollar amount, so it's not $0.00).

For example, 1 item in cart which costs $100, and is taxed at 10.25%. $cart->getTax() returns $9.30* while $cart->getSum() returns $100.00.

*this is something else I don't understand: the tax rate of 10.25% isn't getting applied correctly, and instead returns a number as if it was 9.3%. I see this happening in the "plainkit" example too.

jacoblindgren commented 2 years ago

I notice now that tax is meant to be included in the product price (which seems odd—but maybe makes sense in EU/VAT context), and isn't something that is calculated as a separate thing. This explains everything above.

I'll look into taking cart total and hooking in tax (conditionally, in my case) before payment. I wouldn't want that tax baked in to price, but realize this might be a fundamental different between US tax and EU/VAT.