Action
rpress_pre_remove_from_cart
On this page
Fires before an item is removed from the cart.
Runs at the start of RPRESS_Cart::remove(), before the line is unset.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$key | int | Cart line key (index) to be removed. |
Example#
function my_pre_remove_from_cart( $key ) {
$contents = RPRESS()->cart->get_contents();
if ( isset( $contents[ $key ]['id'] ) ) {
error_log( 'Removing menu item ' . $contents[ $key ]['id'] );
}
}
add_action( 'rpress_pre_remove_from_cart', 'my_pre_remove_from_cart', 10, 1 );
Source#
Fired from:
includes/cart/class-rpress-cart.php(line 422), inRPRESS_Cart::remove()
See also#
Was this page helpful?
