tastyigniter / TastyIgniter

:fire: Powerful, yet easy to use, open-source online ordering, table reservation and management system for restaurants
https://tastyigniter.com
MIT License
3.03k stars 988 forks source link

[Bug]: Delivery charge is not adding to total when Tax is enabled and delivery not taxable #865

Closed ricardochen closed 3 years ago

ricardochen commented 3 years ago

What happened?

The combination of: 1) Delivery Charge 2) Tax enabled 3) Delivery Charge not taxable Causes the cart to not add the delivery charge

Function "calculate" in extensions/igniter/cart/cartconditions/Tax.php is removing the delivery charge if the above conditions apply and then send the subtotal minus the delivery charge to the parent calculate from CartConditions.php.

Something inside CartConditions then calculates the Tax AND the Total based only on the subtotal provided, thus not taking into account the delivery charge since it was discounted previously in Tax.php.

I tried to "fix" it by changing the line $total -= (float)$deliveryCharge; to $total -= (float)$deliveryCharge*($this->taxRate/100);

This will calculate the correct total, however, the Tax is screw up. I do not know how CartConditions.php works to fix this properly.

The version is 3.0.7

What did you expect to happen?

Show the correct tax, and total amount with the delivery charge

Version

Other (please detail)

What browser are you seeing the problem on?

Chrome

Relevant log output

No response

sampoyigi commented 3 years ago

Fixed! Thanks for your debugging efforts!