I want to get parent product data for configurable products.

I have parent id

How do I get it?

  • As a parent configurable product you can get the children simple products. Likewise as a child simple product you can get the parent. Do you want to do either of these? Jun 11, 2019 at 0:44
  • then load the product data based on id use ProductRepositoryInterface and call getById function
    – mohith
    Jun 11, 2019 at 4:54

1 Answer 1


I Got the solution

 use \Magento\Catalog\Model\ProductRepository;
 use \Magento\ConfigurableProduct\Model\Product\Type\Configurable;

Then in construct function use

public function __construct(ProductRepository $_productloader,Configurable $configurable) {

get parent product id by product id

 $productId='get your product id'


$parentId gives an array

then get parent product data by


This worked for me.

  • I had comment the same thing above
    – mohith
    Jun 11, 2019 at 10:13

Your Answer

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

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