0

I try many solutions but i can't get the result please help me for getting associated products from grouped productId like for configurable product we use

$parent_pro = $objectManager->create('Magento\Catalog\Model\Product')->load($productId); 
$_children = $parent_pro->getTypeInstance()->getUsedProducts($parent_pro)

How can I get Grouped child products?

1

Try this

$parent_pro = $objectManager->create('Magento\Catalog\Model\Product')->load($productId); 
$_children = $parent_pro->getTypeInstance(true)->getAssociatedProducts($parent_pro);
foreach ($_children as $child) {
       if ($child->getId() != $parent_pro->getId()) {
        echo "child Id ".$child->getID();
      }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.