Is there any way to get enabled and disabled simple product of configurable product in Magento 2.

I need to get all id of enable and disabled product by using SQL query or object manager approach.

Can anyone tell me SQL query to get all simple product of a config. product.

1 Answer 1


By using SQL Query i will get both enabled and disabled images.

$sql = "Select child_id FROM catalog_product_relation WHERE parent_id = '".$_product->getId()."'";
$sqlresult = $connection->fetchAll($sql);

If anyone has other solution please posted here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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