public function total($format = true, $withDiscount = true, $withTax = true, $withFees = true)
    {
        $total = $this->subTotal(false);

        if ($withFees) {
            $total += $this->feeTotals(false);
        }

        if ($withDiscount) {
            $total -= $this->totalDiscount(false, false);
        }

        if ($withTax) {
            $total += $this->taxTotal(false, $withFees, false);
        }

        return $this->formatMoney($total, null, null, $format);
    }