How to Save Custom Option Field Value When Creating Order Programmatically

custom-optionsorders

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?

Best Answer

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

Related Topic