We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    To get all the children product ids from the configurable product in Magento 2, you need to retrieve the list of child item ids by the configurable product id.

    <?php
    namespace MagemonkeysChildIdsModel;
    
    use MagentoConfigurableProductModelProductTypeConfigurable;
    
    class ConfigurableChildrenIds
    {    
        private $configurable;
        public function __construct(
            Configurable $configurable
        ) {
            $this->configurable = $configurable;
        }
        
        public function getChildrenIds(int $id)
        {
            $childItemId = $this->configurable->getChildrenIds($id);
            return $childItemId;
        }
    } ?>
    

    List out the children items id for a configurable product by using below commands.

    $configurableId = 1478;
    $superAttributeByChild = $this->getChildrenIds($configurableId);

     

    field_5bfb909c5ccae

      Get a Free Quote