Skip to content

Commit

Permalink
Adding a way to get the total tax
Browse files Browse the repository at this point in the history
  • Loading branch information
lukepolo committed Oct 28, 2015
1 parent 48cdc4c commit 725af94
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,24 @@ public function total($formatted = true, $withDiscount = true)
return number_format($total, 2);
}
}

/**
* Gets the total tax for the cart
*
* @param bool|true $formatted
*
* @return string
*/
public function taxTotal($formatted = true)
{
$totalTax = $this->total(false) - $this->subTotal(false, false);

if ($formatted) {
return \LaraCart::formatMoney($totalTax, $this->locale, $this->internationalFormat);
} else {
return number_format($totalTax, 2);
}
}

/**
* Gets all the fee totals
Expand Down

0 comments on commit 725af94

Please sign in to comment.