Do you want to keep order id same? That's what you want or you want your custom OrderId to be instered while creating PurchaseOrder?
var purchaseOrderLink = _orderRepository.SaveAsPurchaseOrder(cart);
var purchaseOrder = _orderRepository.Load<IPurchaseOrder>(purchaseOrderLink.OrderGroupId);
_purchaseOrderProcessor.ProcessOrder(purchaseOrder);
purchaseOrder.OrderStatus = OrderStatus.Completed;
purchaseOrder.OrderNumber = "My Custom Order Number";
This is how you can add your custom order number to a Purchase Order.
I believe Noel wants to keep the OrderGroupId. I don't think that's possible without some nasty hacks
@Praful, are all properties editable in that fashion? if everything is editable i dont mind what initial id it uses
@Quan, I think I have some confusion between order numbers and order group ids, the customers old system will be providing an orderId or order number, and i need to insert all those orders as if they were bought via episerver from the start, so no difference between legacy inserted orders and newly created orders.
I've discovered the ServiceAPI: https://world.episerver.com/documentation/class-libraries/rest-apis/service-api/#/Order/Order_PostOrder
it looks like that lets me insert the OrderNumber?
if you meant the order number, then Yes, you can (via ServiceAPI).
IPurchaseOrder.OrderNumber and PurchaseOrder.TrackingNumber are basically the same thing, and can be set/updated
I need to import historical orders into a new episerver build. The old orders already have an order ID, is it possible to create orders with a specific order ID?