I've simple product assign in bundle items of Bundle product.
Now I've simple product ID and I'm trying to find in which bundle product it's given in bundle items using following code but it returns an empty array.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$parent = $objectManager->create('Magento\Bundle\Model\Product\Type')->getParentIdsByChild($product->getId());
var_dump($parent);
Best Answer
I've done in following way