# Create order from code

**URL:** https://forum.litium.com/t/create-order-from-code/3040
**Category:** Questions
**Tags:** litium-8
**Created:** [September 1, 2023, 9:16am UTC](https://forum.litium.com/t/create-order-from-code/3040 "2023-09-01T09:16:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jiboy.george](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jiboy.george](https://forum.litium.com/u/jiboy.george)
#### Post date: [September 1, 2023, 9:16am UTC](https://forum.litium.com/t/create-order-from-code/3040/1 "2023-09-01T09:16:46Z")

</div>

I am upgrading Litium 7.2.2 to 8.11.2. I have a scheduled task to create order based on the values in a file.

In old version, order is creating using OrderRowCarrier as below

```auto
                    // Create a new order row carrier for each row
                    var orderRowCarrier = new OrderRowCarrier
                    {
                        ID = Guid.NewGuid(),
                        OrderID = orderCarrier.ID,
                        ArticleNumber = artilceNumber,
                        ExternalOrderRowID = orderID,
                        Comments = string.Empty,
                        VATPercentage = 0.25m,
                        Quantity = quantity,
                        UnitListPrice = decimal.Parse(orderRow.SalesPrice.Trim(), new CultureInfo("en-US")),
                    };

                   
                    if (decimal.TryParse(orderRow.Discount > 0)
                    {
                        orderRowCarrier.DiscountPercentage = (Discount / orderRowCarrier.UnitListPrice) * 100;
                    }

```

I found similar question in forum and it using CartContext to create new order - [Create new order using code](https://forum.litium.com/t/create-order-from-code-litium-8/2656).

But i was not able to add any discount or order details (SalesOrder.Row collection in readonly). Is there any alternate way for this?

Litium version: _[Litium 8.11.2]_

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)
#### Post date: [September 29, 2023, 9:16am UTC](https://forum.litium.com/t/create-order-from-code/3040/2 "2023-09-29T09:16:53Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
