OrderItem::UnitPrice PHP Method

UnitPrice() public method

Fetches from db, or Buyable, based on order status.
public UnitPrice ( )
    public function UnitPrice()
    {
        if ($this->Order()->IsCart()) {
            $buyable = $this->Buyable();
            $unitprice = $buyable ? $buyable->sellingPrice() : $this->UnitPrice;
            $this->extend('updateUnitPrice', $unitprice);
            return $this->UnitPrice = $unitprice;
        }
        return $this->UnitPrice;
    }