Filter
rpress_get_cart_discount_html
On this page
Filters the HTML for one applied discount in the cart totals.
Applied inside the loop of rpress_get_cart_discounts_html(), once per applied code. The default markup is a span with the generic label Discount, the discounted amount and a remove link that points to the checkout URL with the remove_cart_discount action. The output is later passed through wp_kses with a restricted set of tags, so unsupported tags and attributes are stripped on the checkout page.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$discount_html | string | The HTML for this discount. |
$discount | string | The discount code. |
$rate | string | The formatted discount rate for the code. |
$remove_url | string | URL that removes the discount from the cart. |
Return value#
string. The HTML for this discount.
Example#
function my_discount_html( $discount_html, $discount, $rate, $remove_url ) {
return '<span class="my-discount">' . esc_html( $discount ) . ' (' . esc_html( $rate ) . ')</span>';
}
add_filter( 'rpress_get_cart_discount_html', 'my_discount_html', 10, 4 );
Source#
Applied in:
includes/discount-functions.php(line 824), inrpress_get_cart_discounts_html()
See also#
Was this page helpful?
