LukePOLO\LaraCart\Traits\CouponTrait::setDiscountOnItem PHP Method

setDiscountOnItem() public method

Sets a discount to an item with what code was used and the discount amount.
public setDiscountOnItem ( CartItem $item, $discountAmount )
$item LukePOLO\LaraCart\CartItem
$discountAmount
    public function setDiscountOnItem(CartItem $item, $discountAmount)
    {
        if (!is_numeric($discountAmount)) {
            throw new InvalidPrice('You must use a discount amount.');
        }
        $this->appliedToCart = false;
        $item->code = $this->code;
        $item->discount = $discountAmount;
        $item->couponInfo = $this->options;
    }