How can I get all the simple products associated with a configurable product? I found how to do the opposite (get a product configurable from a simple product) but that\'s not w
write the below simplest code in block and just call it in your template file to get the products associated products :
$productId = (int)$this->getRequest()->getParam('id');
$objectManager = \Magento\Framework\App\objectManager::getInstance();
$product = $objectManager->create("\Magento\Catalog\Model\Product")->load($productId);
$collection = $product->getTypeInstance()->getAssociatedProducts($product);
$this->setCollection($collection);
now, in template write the below code to print the names :
$collection = $block->getCollection();
foreach ($collection as $key => $value)
{
echo $value->getName();
echo "
";
}