public function getDiscount()
    {
        $amount = 0;
        $cart = ShoppingCart::get();
        $items = $cart->TotalItems;
        $discount = $cart->getDiscount();
        
        if ($this->BasePrice && $discount && $discount->Amount) {
            if ($discount->Type == "Fixed") {
                $amount = ($discount->Amount / $items) * $this->Quantity;
            } elseif ($discount->Type == "Percentage") {
                $amount = (($this->Price / 100) * $discount->Amount) * $this->Quantity;
            }
        }
        
        return $amount;
    }
public function getDiscount()
    {
        $amount = 0;
        $cart = ShoppingCart::get();
        $items = $cart->TotalItems;
        $discount = $cart->getDiscount();
        
        if ($this->BasePrice && $discount && $discount->Amount) {
            if ($discount->Type == "Fixed") {
                $amount = ($discount->Amount / $items) * $this->Quantity;
            } elseif ($discount->Type == "Percentage") {
                $amount = (($this->Price / 100) * $discount->Amount) * $this->Quantity;
            }
        }
        
        return $amount;
    }
public function getDiscount ( ) { $ amount = 0 ; $ cart = ShoppingCart :: get ( ) ; $ items = $ cart -> TotalItems ; $ discount = $ cart -> getDiscount ( ) ; if ( $ this -> BasePrice && $ discount && $ discount -> Amount ) { if ( $ discount -> Type == "Fixed" ) { $ amount = ( $ discount -> Amount / $ items ) * $ this -> Quantity ; } elseif ( $ discount -> Type == "Percentage" ) { $ amount = ( ( $ this -> Price / 100 ) * $ discount -> Amount ) * $ this -> Quantity ; } } return $ amount ; }
Find the total discount amount for this line item

@return Float
Find the total discount amount for this line item