title: How to Get Child Product Ids from a Configurable product
body: <p>I am trying to fetch all child product Ids from configurable product Ids. </p>
  
  <pre><code>$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); 
          $product = $objectManager-&gt;create('\Magento\Catalog\Model\Product');
  
  
  
          $storeManager = $this-&gt;_objectManager-&gt;get('Magento\Store\Model\StoreManagerInterface'); 
          $currentStore = $storeManager-&gt;getStore();
          $mediaUrl = $currentStore-&gt;getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
          $productURL = $mediaUrl.'catalog/product';
          $collection = $this-&gt;_productCollectionFactory-&gt;create();
          $productCollection = $collection-&gt;addAttributeToSelect('*')-&gt;addAttributeToFilter('type_id','configurable');
          $vendor_product = array();
  
          $productData = $product-&gt;getData();
          foreach($productCollection as $prodObj){
              $productData = array();
              $product = $product-&gt;load($prodObj-&gt;getId());
  
                       $productTypeInstance = $product-&gt;getTypeInstance();
              $usedProducts = $productTypeInstance-&gt;getUsedProducts($product);
  
   foreach ($usedProducts  as $child) {
  $productData['childrenIds'][] = $child-&gt;getId();
  }
  </code></pre>
  
  <blockquote>
    <p>I get Ids of my first configurable product in all the cases</p>
  </blockquote>