Skip to content

Commit

Permalink
Merge branch 'master' of github.com:lukepolo/laracart
Browse files Browse the repository at this point in the history
  • Loading branch information
lukepolo committed Jan 27, 2018
2 parents f20a873 + c15ed9c commit 91cbbdd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/CartItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ public function addCoupon(CouponContract $coupon)
$this->code = $coupon->code;
$this->couponInfo = $coupon->options;
$this->discount = $coupon->forItem($this);

return $this;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Coupons/Percentage.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public function __construct($code, $value, $options = [])
*/
public function forItem(CartItem $item)
{
if(config('laracart.tax_item_before_discount')) {
return $item->subTotal(false, false, false , true) * $this->value;
if (config('laracart.tax_item_before_discount')) {
return $item->subTotal(false, false, false, true) * $this->value;
}

return $item->price * $this->value;
Expand Down
2 changes: 1 addition & 1 deletion src/LaraCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ public function subTotal($format = true, $withDiscount = true)
}
}

if($total < 0) {
if ($total < 0) {
$total = 0;
}

Expand Down

0 comments on commit 91cbbdd

Please sign in to comment.