Magento 2 Get Parent Product id from child id.

Magento 2 Get Configurable product id from Child id of configurable. When you have Child id of the P product is available you can simply get the parent config product id.

Create simple block to get parent product id,

now call the function in template file to get Parent Id,