Get all Children items of Bundle Products Magento 2.

How to Get Bundle Product children in Magento 2 By Parent Id?

Bundle Product is generated from multiple simple or virtual product combinations in Magento 2.

You can get all the children items of bundle product by an interface, Magento\Bundle\Api\ProductLinkManagementInterface

Use getChildren() method from the above interface,

Where,
$productSku is the Bundle product SKU,
$optionId is the option id of a bundle which you want to items for specific options.

If $optionId is null, all the children item will be loaded otherwise specific option id’s product will be loaded.

Call from the template or Any PHP class,

The result will be all assigned children items of a bundle.

Output:

Using the SKU value only, You can get the list of items available for the bundle.

To Retrieve the Get Configurable product children ids Magento 2.