Action
rpress_post_add_to_cart
On this page
Fires after a menu item has been added to the cart.
Runs in RPRESS_Cart::add() after the cart has been updated in the session and before checkout errors are cleared.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$fooditem_id | int | Menu item (fooditem) post ID. |
$options | array | Cart options of the added item. |
$items | array | Array with the menu item 'id' and its 'quantity' as initially computed. |
Example#
function my_post_add_to_cart( $fooditem_id, $options, $items ) {
error_log( sprintf( 'Menu item %d added to cart', $fooditem_id ) );
}
add_action( 'rpress_post_add_to_cart', 'my_post_add_to_cart', 10, 3 );
Notes#
The $items array reflects the quantity before merging into an identical line.
Source#
Fired from:
includes/cart/class-rpress-cart.php(line 378), inRPRESS_Cart::add()
See also#
Was this page helpful?
