Manipulation of purchase orders and related items is based on classes and methods in the EPiServer.Commerce.Order namespace.
These are the key interfaces:
IOrderRepository
IOrderRepositoryExtensions
IOrderGroupExtensions
IOrderGroupFactory
Note
If you have more than 10 cart instances, cart cache is not really helpful as the cache invalidation can impact site performance. You can use the episerver:commerce.DisableOrderRepositoryCache setting to turn off cart cache. Only use the setting if you are aware of the consequences. [Applies to version 13.13.0 and higher].
## Create orders
When creating orders using the default implementation of IOrderGroupFactory, there is always an IOrderForm in the Forms collection. There is also always an IShipment on the Shipments collection of the IForm. If you create a custom IOrderGroupFactory, assume you need this as well.
**Example:** Creating a cart, purchase order, and payment plan.
## Load orders
**Example:**Â Loading a cart, wishlist, payment plan, and purchase order.
## Save orders
**Example: **Saving a cart, purchase order, and payment plan.
## Delete orders
**Example: **Deleting an order.
## Work with order forms
**Example: **Creating and deleting an order form.
## Work with shipments
**Example: **Adding and removing shipments from order forms.
## Work with payments
**Example: **Adding and removing payments from order form.
## Work with line items
**Example: **Adding line items to shipments.
## Work with addresses
**Example: **Getting billing and shipping addresses.
## Work with notes
**Example: **Adding notes to orders.
**Related blog post:** [CartHelper is dead, long live IOrderRepository](🔗)