1

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
2
  • 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. Commented May 28, 2014 at 8:55
  • @JulienLachal i have posted answer! you can check now Commented Jun 3, 2014 at 6:05

1 Answer 1

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.