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?
asked May 28, 2014 at 8:49
DRAJI
8554 gold badges20 silver badges38 bronze badges
-
1I'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.Julien Lachal– Julien Lachal2014年05月28日 08:55:46 +00:00Commented May 28, 2014 at 8:55
-
@JulienLachal i have posted answer! you can check nowDRAJI– DRAJI2014年06月03日 06:05:16 +00:00Commented 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
answered Jun 3, 2014 at 5:55
DRAJI
8554 gold badges20 silver badges38 bronze badges
-
I should test that someday. And is it kept throughout the whole Checkout process?Julien Lachal– Julien Lachal2014年06月04日 08:31:35 +00:00Commented Jun 4, 2014 at 8:31
-
yeah. I got these custom values in sales/order module in backend tooDRAJI– DRAJI2014年06月04日 09:27:23 +00:00Commented Jun 4, 2014 at 9:27
-
I guess you must have added another field to the sales_order table then?Julien Lachal– Julien Lachal2014年06月04日 15:44:44 +00:00Commented Jun 4, 2014 at 15:44
default