public function onAddTakeAwayCartItem( Item $item, Cart $cart ) : void

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.

Return Value

None.


Example

/**
 * Fires an event whenever an item is going to be added/updated into the cart.
 * 
 * @param   Item  $item
 * @param   Cart  $cart
 * 
 * @return  void
 * 
 * @throws  Exception  To abort the saving process.
 */
public function onAddTakeAwayCartItem($item, $cart)
{
    // do something here...
}

Changelog

Version Description
1.9.1 Introduced.
Last Update: 2024-05-14 13:27
Helpful?
See Also: