I have been trying to create order programatically, it's working well except custom option.

I have one custom option which reference id is 435. I have tried the following. But it seems not working

$order->setData(array( 'options' => array(
     435 => $customvalue,

I got above suggestion From here

How to save custom option field value when create order programatically?

  • 1
    I've never been able to do so, as the order custom values seem to be lost from one step to the other, the way I worked around this was by using session variables. I'd be interested to see the answer to this too. May 28, 2014 at 8:55
  • @JulienLachal i have posted answer! you can check now
    – DRAJI
    Jun 3, 2014 at 6:05

1 Answer 1


I got an answer for my question from here

Its working rock

$existentOptions['additional_options'][] = array(
'label' => $optiontitle, // Title of custom option field
'value' => $customvalue,  // Value of custom option field

For more details, you can check on my blog here

  • I should test that someday. And is it kept throughout the whole Checkout process? Jun 4, 2014 at 8:31
  • yeah. I got these custom values in sales/order module in backend too
    – DRAJI
    Jun 4, 2014 at 9:27
  • I guess you must have added another field to the sales_order table then? Jun 4, 2014 at 15:44

Your Answer

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

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