Zend certified PHP/Magento developer

Magento 2.2.3 List all configurable’s childs prices when the configurable’s childs are out of stock

For a configurable product, the following code will list the configurable’s childs prices only for the childs that are in stock:

if ($_product->getTypeId() == 'configurable') {

    $_children = $_product->getTypeInstance()->getUsedProducts($_product);
    foreach ($_children as $child){
        echo $child->getPrice();
    }

}

When all childs are out of stock, the code above will not show anything.

For a configurable product that has all its childs out of stock, i would need to list the prices of the childs.

Has someone faced the same situation? I’d love to hear about your ideas or contributions.