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

Fires while removing an item from the cart.


Description

Plugins attached to this event can manipulate the default behavior of the system whenever an item is going to be removed from the cart. An item is considered removed only when the remaining units of the item are equal to 0. The event does not fire in case the quantity gets decreased and there are still other units available in cart.

It is possible to throw an exception to abort the deleting 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 removed from the cart.
 * 
 * @param   Item  $item
 * @param   Cart  $cart
 * 
 * @return  void
 * 
 * @throws  Exception  To abort the removing process.
 */
public function onRemoveTakeAwayCartItem($item, $cart)
{
    // do something here...
}

Changelog

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