Skip to content
Docs
Get RestroPress

Filter

rpress_get_cart_total

Updated
On this page

Filters the cart total.

Runs in RPRESS_Cart::get_total() after subtotal, discounts, tax and fees have been combined and clamped at zero. The method then rounds the filtered value to two decimals.

Parameters#

ParameterTypeDescription
$totalfloatCart total.

Return value#

float. The cart total.

Example#

function my_cart_total( $total ) {
	return max( 0, $total );
}
add_filter( 'rpress_get_cart_total', 'my_cart_total', 10, 1 );

Notes#

The returned value is stored as the cart total and then rounded to two decimals.

Source#

Applied in:

  • includes/cart/class-rpress-cart.php (line 1125), in RPRESS_Cart::get_total()

See also#

Was this page helpful?