WC_Cart_Totals::get_total( string $key = 'total', bool $in_cents = false )

Get a single total with or without precision (in cents).


Description Description


Parameters Parameters

$key

(Optional) Total to get.

Default value: 'total'

$in_cents

(Optional) Should the totals be returned in cents, or without precision.

Default value: false


Top ↑

Return Return

(int|float)


Top ↑

Source Source

File: includes/class-wc-cart-totals.php

	public function get_total( $key = 'total', $in_cents = false ) {
		$totals = $this->get_totals( $in_cents );
		return isset( $totals[ $key ] ) ? $totals[ $key ] : 0;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.