Change custom options value after place order in Magento

<?php
$order = Mage::getModel(‘sales/order’)->load(2547);

foreach ($order->getAllItems() as $item) {
$options = $item->getProductOptions();
$options[‘info_buyRequest’][‘options’][9] = ‘ABCD1’;
$newArray = array(
“label” => ‘Studio Name’,
“value” => ‘ABCD1’,
‘print_value’ => ‘ABCD1’,
‘option_id’ => 9,
‘option_type’ => ‘field’,
‘option_value’ => ‘ABCD1’
);
array_push($options[‘options’], $newArray);
$item->setProductOptions($options);
$item->save();
print_r($item->getProductOptions());
print_r($item->getData());
}

Leave a comment