public static function Utility::cartCount in Basic cart 8.2
Same name and namespace in other branches
- 8.6 src/Utility.php \Drupal\basic_cart\Utility::cartCount()
- 8.3 src/Utility.php \Drupal\basic_cart\Utility::cartCount()
- 8.4 src/Utility.php \Drupal\basic_cart\Utility::cartCount()
- 8.5 src/Utility.php \Drupal\basic_cart\Utility::cartCount()
Get Cart count.
2 calls to Utility::cartCount()
- CartController::addToCart in src/
Controller/ CartController.php - Add node to cart.
- CountBlock::build in src/
Plugin/ Block/ CountBlock.php - Builds and returns the renderable array for this block plugin.
File
- src/
Utility.php, line 443
Class
- Utility
- Utilty functions for basic cart.
Namespace
Drupal\basic_cartCode
public static function cartCount() {
$cart = Utility::getCart();
return isset($cart['cart_quantity']) ? array_sum($cart['cart_quantity']) : 0;
}