Closed foRsxs closed 1 year ago
Hi @foRsxs,
We shouldn't set qty to 0 because of this affects other values including priceTotal
, discountTotal
, total
, etc.
Please take a look at calculator class https://github.com/bumbummen99/LaravelShoppingcart/blob/master/src/Calculation/DefaultCalculator.php#L24
Hi @foRsxs,
We shouldn't set qty to 0 because of this affects other values including
priceTotal
,discountTotal
,total
, etc.Please take a look at calculator class https://github.com/bumbummen99/LaravelShoppingcart/blob/master/src/Calculation/DefaultCalculator.php#L24
Everything working good in Calculator, except priceTarget (divisionByZero)
In PR I can add fix in calculator for check empty qty for priceTarget
case 'priceTarget': return !empty($cartItem->qty) ? round(($cartItem->priceTotal - $cartItem->discountTotal) / $cartItem->qty, $decimals) : 0;
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days
Hi, why set quantity can't set 0 ? For example we have products which can be sell with pieces, but counting with box (like pharmacy products) So sometimes main qty is zero but in options we have pieces.
Have any chance to apply this if I send PR?
` public function setQuantity($qty) { if (!isset($qty) || !is_numeric($qty)) { throw new \InvalidArgumentException("Please supply a valid quantity."); }