WC_Cart_Totals::get_total
Get a single total with or without precision (in cents).
Method of the class: WC_Cart_Totals{}
No Hooks.
Returns
Int|float.
Usage
$WC_Cart_Totals = new WC_Cart_Totals(); $WC_Cart_Totals->get_total( $key, $in_cents );
- $key(string)
- Total to get.
Default: 'total' - $in_cents(true|false)
- Should the totals be returned in cents, or without precision.
Default: false
Changelog
| Since 3.2.0 | Introduced. |
WC_Cart_Totals::get_total() WC Cart Totals::get total code WC 10.4.3
public function get_total( $key = 'total', $in_cents = false ) {
$totals = $this->get_totals( $in_cents );
return isset( $totals[ $key ] ) ? $totals[ $key ] : 0;
}