Your cart is empty!
Remove Item Option
public function onRemoveOptionCart(int $id_option, VAPCartItem $item) : bool
Fires before detaching an option from an appointment.
Description
Trigger event before detaching an option from the specified service.
It is possible to use this hook, in example, to prevent the customers from deleting specific options.
Notice that you can access the information of the option by using the following code.
$index = $item->indexOf($id_option);
$option = $item->getOptionAt($index);
Parameters
- $id_option
-
(int) The option ID.
- $item
-
(VAPCartItem) The item that own the option to delete.
Return Value
Boolean. True to delete the option from the cart, false to keep it.
Example
/**
* Trigger event before detaching an option from the item.
*
* @param integer $id_option The option ID.
* @param mixed $item The cart item instance.
*
* @return boolean True to delete the option, false otherwise.
*/
public function onRemoveOptionCart($id_option, $item)
{
/**
* @todo check whether the option should be removed or not
*/
return true;
}
Changelog
Version | Description |
---|---|
1.6 | Introduced. |
Last Update: 2021-10-06 16:32
Helpful?