Skip to content
Docs
Get RestroPress

Filter

rpress_get_discount_amount

Updated
On this page

Filters the discount amount.

Runs in RPRESS_Discount::get_amount(). The filtered value is cast to float before it is returned. Whether it is read as a percentage or a flat amount depends on the discount type.

Available since RestroPress 1.0.6.

Parameters#

ParameterTypeDescription
$amountfloatThe discount amount.
$discount_idintThe discount ID.

Return value#

float. The discount amount to use.

Example#

function my_get_discount_amount( $amount, $discount_id ) {
	return min( (float) $amount, 50 );
}
add_filter( 'rpress_get_discount_amount', 'my_get_discount_amount', 10, 2 );

Source#

Applied in:

  • includes/class-rpress-discount.php (line 790), in RPRESS_Discount::get_amount()

See also#

Was this page helpful?