public static function Utility::addToCart in Basic cart 8.4
Same name and namespace in other branches
- 8.6 src/Utility.php \Drupal\basic_cart\Utility::addToCart()
- 8 src/Utility.php \Drupal\basic_cart\Utility::addToCart()
- 8.0 src/Utility.php \Drupal\basic_cart\Utility::addToCart()
- 8.2 src/Utility.php \Drupal\basic_cart\Utility::addToCart()
- 8.3 src/Utility.php \Drupal\basic_cart\Utility::addToCart()
- 8.5 src/Utility.php \Drupal\basic_cart\Utility::addToCart()
Add to cart.
Parameters
int $id: Node id.
array $params: Quantity and entity types.
2 calls to Utility::addToCart()
- CartController::addToCart in src/
Controller/ CartController.php - Add node to cart.
- CartController::addToCartNoRedirect in src/
Controller/ CartController.php - Add node to cart.
File
- src/
Utility.php, line 97
Class
- Utility
- Utilty functions for basic cart.
Namespace
Drupal\basic_cartCode
public static function addToCart($id, array $params = array()) {
$storage = static::getStorage();
$storage
->addToCart($id, $params);
}