Skip to content
Docs
Get RestroPress

Filter

rpress_get_cart_items_subtotal

Updated
On this page

Filters the subtotal of a set of cart items.

Runs in RPRESS_Cart::get_items_subtotal() after the 'subtotal' values of the supplied item details have been summed and clamped at zero. The result is stored on the cart.

Parameters#

ParameterTypeDescription
$subtotalfloatSum of the item subtotals.

Return value#

float. The subtotal.

Example#

function my_cart_items_subtotal( $subtotal ) {
	return round( $subtotal, 2 );
}
add_filter( 'rpress_get_cart_items_subtotal', 'my_cart_items_subtotal', 10, 1 );

Notes#

Also used for the discountable subtotal, so the value may cover only part of the cart.

Source#

Applied in:

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

See also#

Was this page helpful?