Skip to content
Docs
Get RestroPress

Action

rpress_post_add_to_cart

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

ParameterTypeDescription
$fooditem_idintMenu item (fooditem) post ID.
$optionsarrayCart options of the added item.
$itemsarrayArray 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), in RPRESS_Cart::add()

See also#

Was this page helpful?