I am programatically saving orders. I need to be able to set a custom data for order items in sales_order_item table. What is the best way to do this?

I notice there is an additional_data column which looks ideal, however, I don't seem to be able to save data to it.

Code of what I've tried below...

$cartId = $this->cartManagementInterface->createEmptyCart();
$quote = $this->cartRepositoryInterface->get($cartId);
 * Try to add the column here
$product->setData('additional_data', json_encode(["ewfe" => 'wefwef']));
$quote->addProduct($product, 1);

// Set all shipping / customer details etc

$quote->getPayment()->importData(['method' => 'checkmo']);

// Create Order From Quote
$quote = $this->cartRepositoryInterface->get($quote->getId());
$orderId = $this->cartManagementInterface->placeOrder($quote->getId());

Running this saves the order, but does not add any data to the additional_data column.

1 Answer 1


For anyone interested, this is how I solved it...

$item = $quote->addProduct($product, 1);
$item->setAdditionalData('custom data');

$quote->addProduct() returns a reference to the internal cart item.

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.