Skip to content
Docs
Get RestroPress

Filter

rpress_get_cart_discounted_amount

Updated
On this page

Filters the total discount amount of the cart.

Runs in RPRESS_Cart::get_discounted_amount(). The value is the sum of the discount values of the cart's discount codes (or the codes passed in). It feeds into the cart total.

Parameters#

ParameterTypeDescription
$discount_sumfloatTotal discount amount.

Return value#

float. The total discount amount.

Example#

function my_cart_discounted_amount( $discount_sum ) {
	return max( 0, $discount_sum );
}
add_filter( 'rpress_get_cart_discounted_amount', 'my_cart_discounted_amount', 10, 1 );

Notes#

Applied at three return points in the method, always with the same argument.

Source#

Applied in:

  • includes/cart/class-rpress-cart.php (line 1060), in RPRESS_Cart::get_discounted_amount()
  • includes/cart/class-rpress-cart.php (line 1063), in RPRESS_Cart::get_discounted_amount()
  • includes/cart/class-rpress-cart.php (line 1076), in RPRESS_Cart::get_discounted_amount()

See also#

Was this page helpful?