Filter
rpress_get_discount_amount
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#
| Parameter | Type | Description |
|---|---|---|
$amount | float | The discount amount. |
$discount_id | int | The 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), inRPRESS_Discount::get_amount()
See also#
Was this page helpful?
