You are here

protected function CartBlockBase::getCarts in Commerce Cart Blocks 8

5 calls to CartBlockBase::getCarts()
CartBlockBase::buildLinks in src/Plugin/Block/CartBlockBase.php
CartBlockBase::getCacheabilityMetadata in src/Plugin/Block/CartBlockBase.php
CartBlockBase::getCartCount in src/Plugin/Block/CartBlockBase.php
CartBlockBase::getCartViews in src/Plugin/Block/CartBlockBase.php
Gets the cart views for each cart.
CartBlockBase::getTotal in src/Plugin/Block/CartBlockBase.php
Gets the total price of the carts.

File

src/Plugin/Block/CartBlockBase.php, line 319

Class

CartBlockBase
CartBlockBase class.

Namespace

Drupal\commerce_cart_blocks\Plugin\Block

Code

protected function getCarts() {

  /** @var \Drupal\commerce_order\Entity\OrderInterface[] $carts */
  $carts = $this->cartProvider
    ->getCarts();
  return array_filter($carts, function ($cart) {

    /** @var \Drupal\commerce_order\Entity\OrderInterface $cart */
    return $cart
      ->hasItems() && $cart->cart->value;
  });
}