Filter
rpress_discounted_amount
On this page
Filters the discounted amount calculated for a single base price.
Runs at the end of RPRESS_Discount::get_discounted_amount(). The value is the base price after applying the discount: for flat discounts the amount is subtracted and floored at zero, for percentage discounts the percentage is removed. Note that only the amount is passed, not the discount object.
Available since RestroPress 1.0.6.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$amount | float | Calculated discounted amount. |
Return value#
float. The adjusted discounted amount.
Example#
function my_discounted_amount( $amount ) {
// Never let a discount reduce an item below 1.00.
return max( 1.00, (float) $amount );
}
add_filter( 'rpress_discounted_amount', 'my_discounted_amount' );
Source#
Applied in:
includes/class-rpress-discount.php(line 1854), inRPRESS_Discount::get_discounted_amount()
See also#
Was this page helpful?
