LukePOLO\LaraCart\CartSubItem::price PHP Method

price() public method

Gets the formatted price.
public price ( boolean | true $format = true, boolean $taxedItemsOnly = true ) : string
$format boolean | true
$taxedItemsOnly boolean
return string
    public function price($format = true, $taxedItemsOnly = true)
    {
        $price = $this->price;
        if (isset($this->items)) {
            foreach ($this->items as $item) {
                if ($taxedItemsOnly && !$item->taxable) {
                    continue;
                }
                $price += $item->price(false, $taxedItemsOnly);
            }
        }
        return LaraCart::formatMoney($price, $this->locale, $this->internationalFormat, $format);
    }