/** * @inheritdoc */ public function getChildren($productId) { $product = $this->productRepository->get($productId); if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { throw new Exception('Only implemented for bundle product', Exception::HTTP_FORBIDDEN); } $childrenList = []; foreach ($this->getOptions($product) as $option) { /** @var \Magento\Catalog\Model\Product $selection */ foreach ($option->getSelections() as $selection) { $childrenList[] = $this->metadataConverter->createDataFromModel($selection, $product); } } return $childrenList; }