/** * @param ProductInterface $product * * @return ProductInterface[] */ protected function getAssociatedProducts(ProductInterface $product) { $associatedProducts = []; foreach ($product->getAssociations() as $association) { if ($association->getType()->getCode() == 'webburza_customers_also_bought_bundle') { foreach ($association->getAssociatedObjects() as $object) { $associatedProducts[] = $object; } } } return $associatedProducts; }