Your cart is empty!
Add Item
do_action( 'vikrestaurants_add_take_away_cart_item', Item $item, Cart $cart )
Fires while adding (or updating) an item into the cart.
Description
Plugins attached to this event can manipulate the default behavior of the system whenever an item is going to be added, or updated, into the cart.
It is possible to throw an exception to abort the saving process.
Parameters
- $item
-
(Item) The object holding the details of the item. This class is part of the
E4J\VikRestaurants\TakeAway\Cart
namespace. - $cart
-
(Cart) The object holding the cart items. This class is part of the
E4J\VikRestaurants\TakeAway\Cart
namespace.
Example
/**
* Fires an action whenever an item is going to be added/updated into the cart.
*
* @param Item $item
* @param Cart $cart
*
* @throws Exception To abort the saving process.
*/
add_action('vikrestaurants_add_take_away_cart_item', function($item, $cart) {
// do something here...
}, 10, 2);
Changelog
Version | Description |
---|---|
1.3.3 | Introduced. |
Last Update: 2024-05-14
Helpful?