Action
rpress_cart_discount_removed
On this page
Fires after a discount code has been removed from the cart.
Runs when a single discount code is removed, from RPRESS_Cart::remove_discount() and from rpress_unset_cart_discount(). Both paths fire it after the session has been updated, before rpress_cart_discounts_updated.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$code | string | The removed discount code. |
$discounts | string|array | The remaining discount codes, normally as a string joined with the pipe character (an array or empty value when none remain). |
Example#
function my_cart_discount_removed( $code, $discounts ) {
error_log( 'Discount removed: ' . $code );
}
add_action( 'rpress_cart_discount_removed', 'my_cart_discount_removed', 10, 2 );
Notes#
The type of $discounts depends on the caller and whether any codes remain; do not rely on it being an array.
Source#
Fired from:
includes/cart/class-rpress-cart.php(line 508), inRPRESS_Cart::remove_discount()includes/discount-functions.php(line 704), inrpress_unset_cart_discount()
See also#
Was this page helpful?
