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);
}
if ($withTax) {
$total += $this->taxTotal(false);
}
return $this->formatMoney($total, null, null, $format);
}