Filter
rpress_get_cart_content_details_item_discount_amount
On this page
Filters the discount amount calculated for a cart line in the cart content details.
Runs in RPRESS_Cart::get_contents_details() for each cart line, after get_item_discount_amount() has produced the line's discount. The result is stored as the 'discount' of that line and feeds into subtotals and totals.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$discount | float | Discount amount calculated for the cart line. |
$item | array | The cart line. |
Return value#
float. The discount amount for the cart line.
Example#
function my_cart_item_discount( $discount, $item ) {
return max( 0, round( $discount, 2 ) );
}
add_filter( 'rpress_get_cart_content_details_item_discount_amount', 'my_cart_item_discount', 10, 2 );
Source#
Applied in:
includes/cart/class-rpress-cart.php(line 213), inRPRESS_Cart::get_contents_details()
See also#
Was this page helpful?
