You are here

protected function ProductBundleStockProxy::getAllPurchasableEntities in Commerce Product Bundle 8

Gets the currently selected variation of each bundle item.

Parameters

\Drupal\commerce_product_bundle\Entity\BundleInterface $product_bundle: The product bundle.

Return value

\Drupal\commerce_product\Entity\ProductVariationInterface[] All purchasable entities.

2 calls to ProductBundleStockProxy::getAllPurchasableEntities()
ProductBundleStockProxy::getIsAlwaysInStock in modules/commerce_product_bundle_stock/src/ProductBundleStockProxy.php
Check if entity is always in stock.
ProductBundleStockProxy::getIsInStock in modules/commerce_product_bundle_stock/src/ProductBundleStockProxy.php
Check if purchasable entity is in stock.

File

modules/commerce_product_bundle_stock/src/ProductBundleStockProxy.php, line 149

Class

ProductBundleStockProxy
Provides a stock service for product bundles.

Namespace

Drupal\commerce_product_bundle_stock

Code

protected function getAllPurchasableEntities(BundleInterface $product_bundle) {
  return array_map(function ($item) {

    /** @var \Drupal\commerce_product_bundle\Entity\BundleItemInterface $item */
    return $item
      ->getCurrentVariation();
  }, $product_bundle
    ->getBundleItems());
}