I have a virtual product and it consists with various types of custom options such as drop-downs, text fields, radio buttons etc. Once the place order clicks I'm firing an event observer. There I want to get the selected values of all these custom options.

How to achieve this? I can get the option titles. But can't get the selected values of them.

  • you mean ordered item option values? Jul 10, 2015 at 5:53
  • yes, i can get the order item and then the product. But i cannot get the custom option values (selected) of it
    – Sukeshini
    Jul 10, 2015 at 6:01
  • check my answer Jul 10, 2015 at 6:22

2 Answers 2


Try the below code,

    $order = $observer->getEvent()->getOrder();
    $items = $order->getAllVisibleItems();
    foreach ($items as $item) {
    $options = $item->getProductOptions(); 
    $customOptions = $options['options'];   
      foreach ($customOptions as $option)
         $optionTitle = $option['label'];
         $optionId = $option['option_id'];
         $optionType = $option['type'];
         $optionValue = $option['value'];

Got it solved.

public function getProductCustomOptionsData($observer)
        $event = $observer->getEvent();
        $order = $event->getOrder();
        foreach ($order->getAllVisibleItems() as $item){

            $optionArray = $item->getProductOptions();
            foreach($optionArray['options'] as $option) {
                $str = $option['label'] . ' : ' . $option['value'];
                 Mage::log($str, null, 'taxi.log', true);               
  • if you think your answer best suits your question, please accept it so as others know it's the right solution :) Jul 10, 2015 at 7:39
  • ah yh, forgot about that :) Jul 10, 2015 at 7:46

Your Answer

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

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