public function CartSession::removeFromCart in Basic cart 8
Same name and namespace in other branches
- 8.6 src/CartSession.php \Drupal\basic_cart\CartSession::removeFromCart()
- 8.0 src/CartSession.php \Drupal\basic_cart\CartSession::removeFromCart()
- 8.2 src/CartSession.php \Drupal\basic_cart\CartSession::removeFromCart()
- 8.3 src/CartSession.php \Drupal\basic_cart\CartSession::removeFromCart()
- 8.4 src/CartSession.php \Drupal\basic_cart\CartSession::removeFromCart()
- 8.5 src/CartSession.php \Drupal\basic_cart\CartSession::removeFromCart()
* Callback function for cart/remove/. * *
Parameters
int $nid: * We are using the node id to remove the node in the shopping cart
Overrides CartInterface::removeFromCart
File
- src/
CartSession.php, line 52
Class
- CartSession
- Class CartSession.
Namespace
Drupal\basic_cartCode
public function removeFromCart($nid) {
$nid = (int) $nid;
if ($nid > 0) {
unset($_SESSION['basic_cart']['cart'][$nid]);
unset($_SESSION['basic_cart']['cart_quantity'][$nid]);
}
}