WC_Cart::get_total( string $context = 'view' )

Gets cart total after calculation.


Description Description


Parameters Parameters

$context

(Optional) If the context is view, the value will be formatted for display. This keeps it compatible with pre-3.2 versions.

Default value: 'view'


Top ↑

Return Return

(float)


Top ↑

Source Source

File: includes/class-wc-cart.php

	public function get_total( $context = 'view' ) {
		$total = apply_filters( 'woocommerce_cart_' . __FUNCTION__, $this->get_totals_var( 'total' ) );
		return 'view' === $context ? apply_filters( 'woocommerce_cart_total', wc_price( $total ) ) : $total;
	}

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.