1

I need to get details of selected product of a bundled product. I tried following code in cart page. But it's not working.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cart = $objectManager->get('\Magento\Checkout\Model\Cart'); 

// get cart items
$items = $cart->getItems();

// get custom options value of cart items
foreach ($items as $item) {
    $options = $item->getProduct()->getTypeInstance(true)->getOptions($item->getProduct());
    $customOptions = $options['options'];
}

1 Answer 1

0

For Future Seekers:

Try: $customOptions = $options['bundle_options']

It will give you array list of options like this: (this is json representation of data)

"bundle_options": {
                    "55": {
                        "option_id": "55",
                        "label": "Suction tips",
                        "value": [
                            {
                                "title": "Suction Tips (Premium Quality-100Pcs)",
                                "qty": 2,
                                "price": 0
                            }
                        ]
                    }
                },

Your Answer

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

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