public function getDiscount($format = true)
    {
        $amount = 0;

        if ($this->coupon) {
            $amount = $this->coupon->forItem($this);
        } elseif (app('laracart')->findCoupon($this->code)) {
            $amount = $this->discount;
        }

        if ($amount < 0) {
            $amount = $this->price;
        }

        return LaraCart::formatMoney(
            $amount,
            $this->locale,
            $this->internationalFormat,
            $format
        );
    }
public function getDiscount($format = true)
    {
        $amount = 0;

        if ($this->coupon) {
            $amount = $this->coupon->forItem($this);
        } elseif (app('laracart')->findCoupon($this->code)) {
            $amount = $this->discount;
        }

        if ($amount < 0) {
            $amount = $this->price;
        }

        return LaraCart::formatMoney(
            $amount,
            $this->locale,
            $this->internationalFormat,
            $format
        );
    }
public function getDiscount ( $ format = true ) { $ amount = 0 ; if ( $ this -> coupon ) { $ amount = $ this -> coupon -> forItem ( $ this ) ; } elseif ( app ( 'laracart' ) -> findCoupon ( $ this -> code ) ) { $ amount = $ this -> discount ; } if ( $ amount < 0 ) { $ amount = $ this -> price ; } return LaraCart :: formatMoney ( $ amount , $ this -> locale , $ this -> internationalFormat , $ format ) ; }
Gets the discount of an item.

@param bool $format

@return string
Gets the discount of an item .