Skip to content

Commit

Permalink
Avoid negative order total when calculating totals
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
  • Loading branch information
sampoyigi committed Nov 17, 2022
1 parent 4c01c0d commit f9501d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/admin/traits/ManagesOrderItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public function calculateTotals()
->where('is_summable', true)
->sum('value');

$orderTotal = $subtotal + $total;
$orderTotal = max(0, $subtotal + $total);

$totalItems = $this->orderMenusQuery()
->where('order_id', $this->getKey())
Expand Down

0 comments on commit f9501d9

Please sign in to comment.