diff --git a/src/CartItem.php b/src/CartItem.php index 0bf3a8d..675371b 100644 --- a/src/CartItem.php +++ b/src/CartItem.php @@ -412,7 +412,7 @@ class CartItem implements Arrayable, Jsonable case 'priceTotal': return round($this->priceNet * $this->qty, $decimals); case 'subtotal': - return round($this->priceTotal - $this->discountTotal, $decimals); + return max(round($this->priceTotal - $this->discountTotal, $decimals), 0); case 'priceTarget': return round(($this->priceTotal - $this->discountTotal) / $this->qty, $decimals); case 'taxTotal': @@ -435,7 +435,7 @@ class CartItem implements Arrayable, Jsonable case 'priceTotal': return round($this->price * $this->qty, $decimals); case 'subtotal': - return round($this->priceTotal - $this->discountTotal, $decimals); + return max(round($this->priceTotal - $this->discountTotal, $decimals), 0); case 'priceTarget': return round(($this->priceTotal - $this->discountTotal) / $this->qty, $decimals); case 'taxTotal':