Action
rpress_cart_discounts_loaded_from_session
On this page
Fires after the cart discounts have been read from the session.
Runs at the end of RPRESS_Cart::get_discounts_from_session(). It fires during cart setup and again on every call to get_discounts(), because that method reloads from the session first. At this point the cart's discounts value is the raw session string of codes separated by a pipe character, or empty.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$this | RPRESS_Cart | The cart instance. |
Example#
function my_cart_discounts_loaded( $cart ) {
RPRESS()->session->set( 'my_discounts_checked_at', time() );
}
add_action( 'rpress_cart_discounts_loaded_from_session', 'my_cart_discounts_loaded', 10, 1 );
Notes#
Fires frequently; keep callbacks cheap.
Source#
Fired from:
includes/cart/class-rpress-cart.php(line 153), inRPRESS_Cart::get_discounts_from_session()
See also#
Was this page helpful?
