Filter
rpress_get_discount_price_value
On this page
Filters the calculated discount value for a code.
Applied in rpress_get_discount_value() after the value has been calculated from the cart items, the discount type and the item and category restrictions. The function returns the formatted currency string or the raw number depending on its $type argument, but the filter receives the raw number.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$discount_value | float | The calculated discount amount. |
$discount | WP_Post | The discount post object found by code. |
Return value#
float. The discount amount.
Example#
function my_discount_price_value( $discount_value, $discount ) {
return min( $discount_value, 50 );
}
add_filter( 'rpress_get_discount_price_value', 'my_discount_price_value', 10, 2 );
Notes#
The $discount argument is the post object returned by rpress_get_discount_by_code(), not the code string passed to rpress_get_discount_value().
Source#
Applied in:
includes/discount-functions.php(line 1203), inrpress_get_discount_value()
See also#
Was this page helpful?
