I have $quoteItem (Magento\Quote\Model\QuoteItem) which represents a bundle product.

The order options are fetched via

$typeInstance = $quoteItem->getProduct()->getTypeInstance();
$this->orderOptions = $typeInstance->getOrderOptions($quoteItem->getProduct());

But in the returned array, there seems to be no link to the Product Entity IDs of the selections?

It is possible to fetch the available selections for an option:

    $selections = $typeInstance->getSelectionsCollection([self::MY_OPTION_ID], $quoteItem->getProduct());

But can I get the chosen option out of this?


This works:

    $selections = $typeInstance->getSelectionsCollection([self::MY_OPTION_ID], $quoteItem->getProduct());
    $selected = $this->orderOptions['info_buyRequest']['bundle_option'][self::MY_OPTION_ID];
    $product = $selections->getItemById($selected);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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