How to get custom option values from order in Magento?

In this blog we are going to learn to get custom options values for all products in Magento with any specific order.

Product might have custom option dropdown list and in Magento you need to add following code to get these custom values in any specific order. These options are usually attached on product details page and then customer can select the right options then buying the product form the E-Commerce website there.

$incrementId = '100000040';
$order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
foreach ($order->getAllItems() 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'];

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *