Magento – Magento 2 : Get Quote Item Selected Options

cartcustom-optionsmagento2quoteitem

I want to programmatically fetch quote item options which are currently selected.

I've added product with options like following;

Color : Red

Size : 6

enter image description here

Now I want to fetch that selected options programmatically in another Controller.

How can I do that.

Best Answer

You can usually call $item->getProductOptions() to get all options and then sort through to get selected options as mentioned by @Rakesh Jesadiya.

But, Sometimes $item->getProductOptions() returns NULL, then you can call

$item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct());

instead and it will return options in the same format.