cancel
Showing results for 
Search instead for 
Did you mean: 

Using REST api, get parent (configurable item) of a child

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Using REST api, get parent (configurable item) of a child

Given a SKU or entity_id, can you get the parent of an item if this is a variant of a configurable product?

 

another way of asking this question would be:

There is an endpoint .../products/:sku/children to get the children of a configurable product, but is there a way to get the inverse of this operation?

 

Any help is much appreciated.

2 REPLIES 2

Re: Using REST api, get parent (configurable item) of a child

There is no such Web API, but you can make a simple Web API wrapper for the existing PHP API: \Magento\Catalog\Model\Product\Type\AbstractType::getParentIdsByChild()

How to get the parents (configurable) products for a child (simple) onehttps://mage2.pro/t/1599

Re: Using REST api, get parent (configurable item) of a child

Hi,

I'm looking for the same function to use in block class and then display in template file. 

Find parent sku (configurable item) from child and just echo in template file.