While learning Magento development you may have encountered this functionality, to get simple products belonging to the configurable product.
First of all, just decide this is a configurable product.
Our next step is to get a product collection based on the current product. We’ll also say we want to get all attributes.
Yea now we got all products under my configurable products. Just go through the items