Skip to content
Docs
Get RestroPress

Action

rpress_cart_discount_removed

Updated
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#

ParameterTypeDescription
$codestringThe removed discount code.
$discountsstring|arrayThe 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), in RPRESS_Cart::remove_discount()
  • includes/discount-functions.php (line 704), in rpress_unset_cart_discount()

See also#

Was this page helpful?