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