Filter
rpress_get_cart_discounts_html
On this page
Filters the combined HTML for all discounts applied to the cart.
Applied at the end of rpress_get_cart_discounts_html() after each discount has been rendered. The function returns early with no value when no discount is applied, so the filter does not run in that case.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$html | string | Concatenated HTML of all applied discounts. |
$discounts | array | Array of applied discount codes. |
$rate | string | The formatted discount rate of the last discount in the loop. |
$remove_url | string | The remove URL of the last discount in the loop. |
Return value#
string. The combined discounts HTML.
Example#
function my_discounts_html( $html, $discounts, $rate, $remove_url ) {
return '<div class="my-discounts">' . $html . '</div>';
}
add_filter( 'rpress_get_cart_discounts_html', 'my_discounts_html', 10, 4 );
Notes#
The $rate and $remove_url values come from the last loop iteration, so they are only reliable when one discount is applied.
Source#
Applied in:
includes/discount-functions.php(line 827), inrpress_get_cart_discounts_html()
See also#
Was this page helpful?
