I'm looking for get the simple products associated to a configurable one. I'm currently using this : $product->getTypeInstance->getUsedProducts($product); Where $product is a configurable.

But it return me simple products that have quantity > 0. Is there a method to also get the 'out of stock' products from a configurable ?


3 Answers 3


Following class is configurable product type class:


Check the following method for child product collection:

public function getUsedProductCollection($product)

What I have done :


Thank you Sohel Rana !


actually the getUsedProducts method only returns the in-stock products. To solve this problem I did the following:

use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable;

private Configurable $configurable;

public function __construct(Configurable $configurable) 
    $this->configurable = $configurable

public function getAllChildren($productId)

This will return all product ids, including those without stock.

The downside is that just seeing the ID it will be necessary to consult the Repository to get the product data,

Your Answer

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

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