bumbummen99 / LaravelShoppingcart

A simple shopping cart implementation for Laravel
MIT License
505 stars 234 forks source link

Adding negative price items #193

Closed neamtua closed 1 year ago

neamtua commented 1 year ago

I'm trying to add something to the cart with either negative pricing or negative quantity in order to generate global discounts by value (not by percentage).

I do not understand why cart total and subtotal just ignore that line as the value it sets is 0.

For instance -20 qty for 1 euro subtotal is 0. I tried the other way, 20 qty, -1 euro unit price subtotal is still 0. Am i doing something wrong?

neamtua commented 1 year ago

I figured it out minutes after posting this by looking at the calculators. To get an accurate calculation I need to use priceTotal instead of subtotal