# Carts and Orders APIs overview

**How to work with the APIs for Carts and Orders.**

This page describes rules that apply across the Carts and Orders APIs. For what Carts and Orders are and how they behave, see the [Carts and Orders overview](/api/carts-orders-overview.md).

## APIs in this topic

| Resource | Purpose | Reference |
| --- | --- | --- |
| Carts | Represent a shopping cart containing items that a customer intends to purchase. | [Carts](/api/projects/carts.md) |
| Orders | Capture a purchase, usually created from a Cart after a checkout process has been completed. | [Orders](/api/projects/orders.md) |
| Payment Methods | Store payment method details in a reusable and structured model. | [Payment Methods](/api/projects/payment-methods.md) |
| Payments | Track a series of logically connected financial transactions, such as reserving, charging, or refunding money. | [Payments](/api/projects/payments.md) |
| Shopping Lists | Implement a "save-for-later" feature, a shareable wishlist, or a public collection of Products. | [Shopping Lists](/api/projects/shoppingLists.md) |
| Order Edits | Make financial changes to the purchase agreement after the Order has been placed. | [Order Edits](/api/projects/order-edits.md) |
| Order Import | Import existing Orders from a different system or a different Project. | [Order Import](/api/projects/orders-import.md) |
| Order Search | Search a large number of Orders in a Project, for back-office use cases. | [Order Search](/api/projects/order-search.md) |

## Data model

### Line Items

When a Product Variant is added to a Cart, a [Line Item](/search.md?urn=ctp:api:type:LineItem) is created as a snapshot of the Product Variant from the [ProductProjection](/search.md?urn=ctp:api:type:ProductProjection) as follows:

- The [current projection](/api/projects/productProjections.md#current--staged) is used.
- Product Attributes are merged with Variant Attributes. Attributes whose [AttributeDefinition](/search.md?urn=ctp:api:type:AttributeDefinition) has `savedToLineItem` set to `false` are excluded.
- If the Cart is bound to a [Store](/api/projects/stores.md), the following additional checks and projections are performed:
  - For Stores with active [Product Selections](/api/projects/product-selections.md), the selected Product Variant must be included in at least one of the active Product Selections.
  - The selected Product Variant must be [available in a Store](/api/project-configuration-apis-overview.md#products-available-in-store).
  - All [LocalizedStrings](/api/types.md#localizedstring) are [filtered](/api/product-catalog-apis-overview.md#locale-projection) by the locales defined in the Store. If the API cannot find a matching locale in the Store languages, the first locale found in the [Project](/api/projects/project.md) settings is used as a fallback.
  - All [Prices](/api/types.md#price) are [filtered](/api/product-catalog-apis-overview.md#price-projection-by-store) according to the Product distribution Channels defined in the Store. Prices without a Channel are also included.
  - All [ProductVariantAvailabilities](/api/projects/products.md#productvariantavailability) are [filtered](/api/product-catalog-apis-overview.md#inventory-projection-by-store) according to the Inventory supply Channel defined in the Store. Inventory entries without a Channel are also included.

If the Product Variant changes, the relation to the current [ProductProjection](/search.md?urn=ctp:api:type:ProductProjection) is kept, but the Line Item is not updated automatically. The same applies when the `savedToLineItem` value of an AttributeDefinition changes.

The Product data of existing Line Items is updated, and the Product Variant data is copied to the `variant` field of the [LineItem](/search.md?urn=ctp:api:type:LineItem), in the following cases:

- A [Recalculate](/api/projects/carts.md#recalculate) update action is performed with `updateProductData` set to `true`.
- A Cart update triggers an [API Extension](/api/projects/api-extensions.md).
- A Customer [signs in](/search.md?urn=ctp:api:type:CustomerSignin) or Carts are [merged](/search.md?urn=ctp:api:type:MergeCartDraft) with `updateProductData` set to `true`.

A [replicated](/search.md?urn=ctp:api:endpoint:/{projectKey}/carts/replicate:POST) Cart always contains the current Product data.

### Custom Line Items

> The [InventoryMode](/search.md?urn=ctp:api:type:InventoryMode) of a Cart has no effect on Custom Line Items.

### Payment references

An [Order](/api/projects/orders.md) or a [Cart](/api/projects/carts.md) can reference a set of Payments using the [PaymentInfo](/search.md?urn=ctp:api:type:PaymentInfo) object.
A Payment can also reference a [Customer](/api/projects/customers.md), or an [anonymous session](/api/authorization.md#tokens-for-anonymous-sessions).

### Shopping Lists

Shopping Lists typically have Line Items: [ShoppingListLineItems](/api/projects/shoppingLists.md#shoppinglistlineitem) that contain [Products](/api/projects/products.md) and/or [TextLineItems](/api/projects/shoppingLists.md#textlineitem) that use text values to represent any other item.

## Working with the APIs

### Guest checkout

When you create a Cart, Shopping List, or Payment, you can set an `anonymousId` on the resource to link it to the anonymous session.

It is good practice to create an anonymous session only once the visitor begins interacting with the Cart, for example, by adding an item to it. This avoids creating a large number of unused sessions. For more information, see [Manage token requests](/api/authorization/#create-anonymous-sessions-only-once-necessary).

Carts with an `anonymousId` are known as anonymous Carts. If you create an Order from an anonymous Cart, the Order is automatically assigned the same `anonymousId`.

#### Anonymous Carts

For how long an anonymous Cart persists, see [Carts and Orders overview](/api/carts-orders-overview.md#guest-checkout).

The merge of an anonymous Cart with a customer's Cart happens automatically upon [customer sign-in](/api/customers-apis-overview.md#customer-authentication-sign-in) or [sign-up](/search.md?urn=ctp:api:endpoint:/{projectKey}/customers:POST). For the merge methods and when each applies, see [Merge a Cart](/api/carts-orders-apis-overview.md#merge-a-cart).

To keep an anonymous Cart accessible, store the Cart `id` on the client side (for example, in the browser's local storage).
Retrieve the Cart with [Get Cart by ID](/search.md?urn=ctp:api:endpoint:/{projectKey}/carts/{id}:GET).

#### Customer Carts

For how long a customer's Cart persists, see [Carts and Orders overview](/api/carts-orders-overview.md#guest-checkout).

You can retrieve a customer's Cart through the following methods:

- [Authenticate Customer (sign-in)](/api/customers-apis-overview.md#customer-authentication-sign-in)
- [Create Customer (sign-up)](/search.md?urn=ctp:api:endpoint:/{projectKey}/customers:POST)
- [Get Cart by Customer ID](/search.md?urn=ctp:api:endpoint:/{projectKey}/carts/customer-id={customerId}:GET)

### Active Carts

The status of a Cart is defined by its [CartState](/search.md?urn=ctp:api:type:CartState).

For the REST endpoints that retrieve active Carts, see [Get Cart](/api/projects/carts.md#get-cart) and [Query Carts](/api/projects/carts.md#query-carts).

### Update a Cart

For the REST endpoints that update a Cart, see [Update Cart](/api/projects/carts.md#update-cart).

After all update actions are performed, the Cart:

- removes any Line Items that are invalid due to deleted Products, Product Variants, or Prices.

- removes any Line Items that are invalid due to an inactive [StandalonePrice](/search.md?urn=ctp:api:type:StandalonePrice).

  > When a Product is unpublished, any associated Line Items already present in a Cart remain unaffected and can still be ordered. To prevent this, do the following:
  >
  > - If the Product uses Embedded Prices, [remove them](/api/projects/products.md#remove-price) from the unpublished Product.
  > - If the Product uses Standalone Prices, [deactivate](/api/projects/standalone-prices.md#change-active) or [delete](/search.md?urn=ctp:api:endpoint:/{projectKey}/standalone-prices/{id}:DELETE) the Standalone Prices.

- removes any Line Items with quantities that are outside the limits specified in their associated [InventoryEntries](/api/projects/inventory.md#inventoryentry).

- updates any [LineItem](/search.md?urn=ctp:api:type:LineItem) `price` field if the result of the [Line Item price selection](/api/pricing-and-discounts-overview.md#price-selection) has changed because of a Product update.

- updates the [ShippingInfo](/search.md?urn=ctp:api:type:ShippingInfo), in particular, the `price` and `shippingMethodState` fields.

- updates the discounts, which may affect the [LineItem](/search.md?urn=ctp:api:type:LineItem) or [CustomLineItem](/search.md?urn=ctp:api:type:CustomLineItem) `totalPrice` fields and [ShippingInfo](/search.md?urn=ctp:api:type:ShippingInfo) `discountedPrice` field:

  - if a [Cart Discount](/api/projects/cartDiscounts.md) becomes invalid due to deactivation, expiration, or the predicate no longer matches the Cart's content, the discount is removed.
  - if a Cart Discount becomes active and applicable (since the last update), the discount is added.
  - if a [Discount Code](/api/projects/discountCodes.md) becomes invalid due to usage limits, deactivation, expiration, or the predicate no longer matches the Cart's content, the discount is removed.

- updates the [Cart](/search.md?urn=ctp:api:type:Cart) `totalPrice` field.

- updates the Tax Rates, in particular, the `taxedPrice` field.

- updates the [LineItem](/search.md?urn=ctp:api:type:LineItem) `productKey`.

To perform the above-mentioned updates without additional update actions, send a request with only the [Recalculate](/api/projects/carts.md#recalculate) update action.

To update the Product data saved in the Line Items, use the [Recalculate](/api/projects/carts.md#recalculate) update action with `updateProductData` set to `true`.

For best practices on optimizing the performance of large or complex Carts, see [Large Cart performance tips](/api/large-cart-performance-tips.md).

### Freeze a Cart

When freezing a Cart, you specify a [FreezeStrategy](/search.md?urn=ctp:api:type:FreezeStrategy): `SoftFreeze` or `HardFreeze`.

The following behavior applies to frozen Carts with the `SoftFreeze` strategy:

- Prices remain as they were when the Cart was frozen. However, if a Price that a Line Item depends on is deleted entirely, the affected Line Item is removed from the frozen Cart.
- Update actions as well as background services modifying prices on the Cart are deactivated for frozen Carts.
- Inventory is not reserved for Line Items in frozen Carts.
- Frozen Carts can be [ordered](/search.md?urn=ctp:api:endpoint:/{projectKey}/orders:POST) or [unfrozen](/api/projects/carts.md#unfreeze-cart). When unfrozen, a Cart continues to accept new updates.

The `HardFreeze` strategy includes all the `SoftFreeze` behavior listed above, plus the following additional restrictions:

- Discounts and Discount Codes remain as they were when the Cart was frozen.
- Shipping method updates are not allowed.

#### Impact of changes on frozen Carts

| Resource | Change | `SoftFreeze` behavior | `HardFreeze` behavior |
| --- | --- | --- | --- |
| **Prices** | Updated | Ignored. The frozen Cart retains the price at the time of freezing. | Same as `SoftFreeze` |
|  | Expired | Ignored. The frozen Cart retains the price at the time of freezing. | Same as `SoftFreeze` |
|  | Deleted | The Line Item that uses the deleted price is removed from the frozen Cart. | Same as `SoftFreeze` |
| **Cart Discounts** | Created | Ignored. New Cart Discounts are not applied. | Same as `SoftFreeze` |
|  | Activated | Ignored. Cart Discounts that become active are not applied. | Same as `SoftFreeze` |
|  | Expired | Remain applied as they were at the time of freezing. | Same as `SoftFreeze` |
|  | Inactivated | Removed from the frozen Cart. | Remain applied as they were at the time of freezing. |
|  | Deleted | Removed from the frozen Cart. | Remain applied as they were at the time of freezing. |
|  | Invalidated (due to Cart predicates not matching) | Removed from the frozen Cart. | Remain applied as they were at the time of freezing. |
| **Product Discounts** | Created | Ignored. New product discounts are not applied. | Same as `SoftFreeze` |
|  | Expired | Remain applied as they were at the time of freezing. | Same as `SoftFreeze` |
|  | Inactivated | Remain applied as they were at the time of freezing. | Same as `SoftFreeze` |
|  | Deleted | Remain applied as they were at the time of freezing. | Same as `SoftFreeze` |
| **Discount Codes** | Created | Can be added. If the Discount Code predicate does not match the Cart, the `state` changes to `DoesNotMatchCart` and doesn't change the Cart total. | Cannot be added. |
|  | Removed (from Cart) | Can be removed, and the Cart total is updated. | Cannot be removed. |
|  | Invalidated (due to Cart predicates not matching) | Discount Code remains in the Cart, the `state` changes to `DoesNotMatchCart`, and the Cart total is updated. If later, the Discount Code becomes valid, it will not automatically re-apply. | Remain applied as they were at the time of freezing (predicate is not re-evaluated). |
|  | Inactivated | Discount Code remains in the Cart, the `state` changes to `NotActive` and the discount is removed, updating the Cart total. | Remain applied as they were at the time of freezing. |
|  | Deleted (from Project) | Discount Code remains in the Cart with the last known status (for example: `NotActive`), but no longer affects the Cart total. | Remain applied as they were at the time of freezing. |
| **Direct Discounts** | Set (on Cart) | Added to the cart, but not applied. | Cannot be set. |
|  | Removed (from Cart) | Can be removed, and the Cart total is updated. | Cannot be removed. |
| **Other** | Updates that affect the price of Cart items | Not accepted. Maintains price stability of the Line Items and Custom Line Items. To view the list of price-related updated actions that are not allowed, see the `frozen` [CartState](/search.md?urn=ctp:api:type:CartState). | Same as `SoftFreeze` |
|  | Updates that do not affect the price of Cart items | Accepted, and the Cart total is updated accordingly. Setting shipping methods is permitted even though it can affect the price. | Setting shipping methods is not allowed. |
|  | Inventory quantity limit updates | During order creation: if line item quantities fall outside the new limits, order creation will fail.When unfrozen: line items violating the new limits will be removed. | Same as `SoftFreeze` |
|  | Anonymous user signs in or signs up | The frozen Cart is not [merged](/api/customers-overview.md#cart-merge-during-sign-in-and-sign-up). | Same as `SoftFreeze` |
|  | The Shipping Method on the Cart is not active | Order creation is rejected. | Same as `SoftFreeze` |
|  | A global Shipping Method on the Cart is replaced with a Store-scoped Shipping Method | Store validations for the Shipping Method are bypassed, and the Order is created. | Same as `SoftFreeze` |
|  | A Store-scoped Shipping Method on the Cart is associated with a different Store | Store validations for the Shipping Method are bypassed, and the Order is created. | Same as `SoftFreeze` |

> When applying update actions, the API still performs validations on the Cart to ensure that it is convertible to an [Order](/api/projects/orders.md), and reports errors if such a validation fails.

Creating an Order will fail if the frozen Cart contains a Discount that must be removed (according to the previously mentioned restrictions), or if a Tax Rate for one or more items has changed.

### Lock a Cart

The Cart's `lock` [field](/api/projects/carts.md#cart) is set when the Cart is locked. A [CartLock](/search.md?urn=ctp:api:type:CartLock) records which API Client locked the Cart and when.

Only API Clients with the `manage_locked_carts` [OAuth 2.0 Scope](/api/scopes.md) can do the following:

- [Lock](/api/projects/carts.md#lock-cart) a Cart.
- Update a locked Cart.
- [Unlock](/api/projects/carts.md#unlock-cart) a Cart.

### Merge a Cart

To be eligible for a Cart merge, the anonymous Cart and the Customer's active Cart must use the same currency (identified through `totalPrice.currency`). Furthermore, if a [Store](/api/projects/stores.md) or [Business Unit](/api/projects/business-units.md) is assigned to either Cart, it must match across both Carts. If the anonymous Cart has [Direct Discounts](/api/pricing-and-discounts-overview.md#direct-discounts), its `directDiscountsIgnoreCartDiscounts` value must match that of the Customer's active Cart as well.

| Merge method | Use for | API | Endpoints |
| --- | --- | --- | --- |
| Automatic Cart merge during sign-up or sign-in | Customers authenticating through the [Internal OAuth](/api/authorization.md#request-an-access-token-using-the-internal-oauth-20-service). | Customers API | All [sign-up](/search.md?urn=ctp:api:endpoint:/{projectKey}/customers:POST) and [sign-in](/search.md?urn=ctp:api:endpoint:/{projectKey}/login:POST) endpoints. See the [Customers APIs overview](/api/customers-apis-overview.md#cart-merge-during-sign-in-and-sign-up) page for more information. |
| Manual Cart merge | Customers authenticating through the [Internal OAuth](/api/authorization.md#request-an-access-token-using-the-internal-oauth-20-service) or an [external OAuth server](/api/authorization.md#request-an-access-token-using-an-external-oauth-server). | Carts API | [Merge Cart](/search.md?urn=ctp:api:endpoint:/{projectKey}/carts/customer-id={customerId}/merge:POST), [Merge Cart in Store](/search.md?urn=ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts/customer-id={customerId}/merge:POST) |

#### Merge modes

The merge mode determines how an anonymous Cart and a Customer's active Cart are combined during a merge operation:

- For automatic Cart merge during sign-up or sign-in, use [AnonymousCartSignInMode](/search.md?urn=ctp:api:type:AnonymousCartSignInMode).
- For manual Cart merge, use [CartMergeMode](/search.md?urn=ctp:api:type:CartMergeMode).

Both types have identical enum values and merging behavior.

> When multiple active Carts are associated with a Customer, the most recently modified active Cart is selected for the merge operation.

##### MergeWithExistingCustomerCart

The following behavior describes the `MergeWithExistingCustomerCart` merge mode:

| Scenario | What happens | Tax recalculation |
| --- | --- | --- |
| Customer has no active Cart | Anonymous Cart becomes the active Cart | Yes, normal tax/price recalculation when the new Cart becomes active |
| Customer has an active Cart without a shipping address | Items from anonymous Cart are merged into the existing active Cart according to the [merge rules](/api/carts-orders-apis-overview.md#merge-rules). | No |
| Customer has an active Cart with a shipping address | Items from anonymous Cart are merged into the existing active Cart according to the [merge rules](/api/carts-orders-apis-overview.md#merge-rules). | Yes, tax rates are recalculated based on the active Cart’s shipping address, even if the anonymous Cart doesn't have one |

##### UseAsNewActiveCustomerCart

The following behavior describes the `UseAsNewActiveCustomerCart` merge mode.

| Scenario | What happens | Tax recalculation |
| --- | --- | --- |
| Customer has no active Cart | Anonymous Cart becomes the active Cart | Yes, price/tax recalculation occurs when it becomes the active Cart |
| Customer has an active Cart without a shipping address | Anonymous Cart becomes the active Cart | No |
| Customer has an active Cart with a shipping address | Anonymous Cart becomes the active Cart | Yes, but only if the anonymous Cart does not have its own shipping address |

#### Merge rules

When merging an anonymous Cart and a Customer’s active Cart, the system follows specific rules to determine how to combine the items. The goal is to ensure that the resulting Cart accurately reflects the Customer's intended purchases without duplicating items unnecessarily.

The merge process follows these steps:

1. **Key conflict check**: The system checks whether any Line Items and Custom Line Items in the anonymous Cart share the same `key` as items in the Customer’s Cart but refer to different products or variants. If a key conflict is detected, the conflicting items from the anonymous Cart are **skipped** and not considered further. These items are not added to the merge result and remain only in the anonymous Cart.

2. **Property-based matching**: For all remaining Line Items and Custom Line Items, the system determines whether items from the anonymous Cart match items in the Customer’s Cart. To do this, it compares specific properties of the items, as detailed in the table below. All properties listed for each item type must match exactly for the items to be considered identical.

   > Keys are **not** considered in the property-based matching logic. Two items are considered identical if the following properties match, even if their keys differ or if one item has no key.

| Item type | Properties compared |
| --- | --- |
| Line Items | `productId`, `variantId`, `supplyChannel`, `distributionChannel`, `custom`, `priceMode` |
| Custom Line Items | `name`, `slug`, `money`, `taxCategory`, `custom` |

3. **Merging behavior**: The system processes each item from the anonymous Cart based on the results of the property-based matching.

   - If an anonymous Cart item matches an existing Customer Cart item:
     - The items are **merged**. The resulting item uses the **higher of the two quantities**.
     - The `itemShippingAddresses` from both items are merged into the Customer Cart.

   - If an anonymous Cart item does not match an existing Customer Cart item, it is **added as a separate item** with its original quantity.

For Carts with `Multiple` `ShippingMode`, the `shipping` arrays from both Carts are merged. A `Shipping` entry is only retained if its `shippingKey` is still referenced by an item.

After the merge is complete, the anonymous Cart retains its original content, and its `cartState` is updated to `Merged`. Although this [CartState](/search.md?urn=ctp:api:type:CartState) prevents any further modifications to the Cart, you can use the Cart to check for any items that could not be merged.

### Lifetime

The lifetime of a [Cart](/search.md?urn=ctp:api:type:Cart) is controlled by the `deleteDaysAfterLastModification` property and can be adjusted according to your requirements. If unspecified, during Cart creation, the `deleteDaysAfterLastModification` property is copied from the Project's [Carts configuration](/api/projects/project.md#cartsconfiguration). Changing the Project's Carts configuration does not affect existing Carts. For details about automatic cleanup behavior and defaults, see [Cleanup of old data](/api/general-concepts.md#cleanup-of-old-data).

Any read method on a Cart alone will not lead to a representation with up-to-date prices and so on, only Cart updates will trigger this.

### Price precision

- Prices with [TypedMoney](/api/types.md#typedmoney) can be cent-precision or high-precision.
- When calculating net and gross prices, prices with decimals are rounded. If the fraction of `centAmount` is exactly 0.5, the [RoundingMode](/search.md?urn=ctp:api:type:RoundingMode) defined by `taxRoundingMode` is applied.
  If the tax is included in the price (`includedInPrice=true` on the [TaxRate](/search.md?urn=ctp:api:type:TaxRate)), the rounding mode is applied to the amount named by the Tax Rate's [taxRoundingTarget](/search.md?urn=ctp:api:type:TaxRoundingTarget), which defaults to the net price. The other amount is then the exact remainder.
  If the tax is not included in the price, the rounding mode is applied to the gross price.
- If the tax is not included in the price (`includedInPrice=false` on the [TaxRate](/search.md?urn=ctp:api:type:TaxRate)), the tax portions are derived from the net prices.
  If the tax is included in the price (`includedInPrice=true` on the [TaxRate](/search.md?urn=ctp:api:type:TaxRate)), then the tax portions are derived from the gross prices.
- If tax is included in the Line Item price (`includedInPrice=true` on the [TaxRate](/search.md?urn=ctp:api:type:TaxRate)), the (discounted) price multiplied by the quantity applies to the gross price of a Line Item. If `includedInPrice=false`, the (discounted) price multiplied by the quantity applies to the net price of a Line Item. If a Line Item's prices are of [HighPrecisionMoney](/api/types.md#highprecisionmoney), `priceRoundingMode` is used for rounding the calculations.
- When prices are discounted with [relative discounts](/api/projects/cartDiscounts.md#cartdiscountvaluerelative), they are always rounded in favor of the customer with [half-down rounding](https://en.wikipedia.org/wiki/Rounding#Rounding_half_down).

#### Tax rounding target

When `includedInPrice` is `true` on a [TaxRate](/search.md?urn=ctp:api:type:TaxRate), both the net price and the tax amount are derived from the gross price. Only one can be rounded; the other is the exact remainder, so `totalNet` plus `totalTax` on [TaxedPrice](/search.md?urn=ctp:api:type:TaxedPrice) always equals `totalGross`. The [taxRoundingTarget](/search.md?urn=ctp:api:type:TaxRoundingTarget) field on the Tax Rate selects which amount is rounded:

- `Net` (default) rounds the net price. The tax amount is the exact remainder.
- `Tax` rounds the tax amount. The net price is the exact remainder. Use this where the tax authority expresses the calculation as a fraction of the gross price. UK VAT at 20%, defined by HM Revenue & Customs (HMRC), is one example.

For a rate of 20% included in a gross price of 1.23 with `taxRoundingMode: HalfEven`:

- `taxRoundingTarget: Net` gives a net price of 1.02 and a tax amount of 0.21.
- `taxRoundingTarget: Tax` gives a tax amount of 0.20 and a net price of 1.03.

The field has no effect when `includedInPrice` is `false`. The supplied price is the exact net in that case, so rounding the gross and rounding the tax give the same result.

Set the field on a Tax Category with the [Add TaxRate](/search.md?urn=ctp:api:type:TaxCategoryAddTaxRateAction) or [Replace TaxRate](/search.md?urn=ctp:api:type:TaxCategoryReplaceTaxRateAction) update action. To override it for a single Line Item, Custom Line Item, or Shipping Method, use an [ExternalTaxRateDraft](/search.md?urn=ctp:api:type:ExternalTaxRateDraft).

#### Cash or denomination rounding

> Cash rounding is not the same as the [RoundingMode](/search.md?urn=ctp:api:type:RoundingMode) set by `priceRoundingMode` and `taxRoundingMode` on a Cart. Those control how decimal midpoints in calculated values are resolved; cash rounding rounds to the nearest currency denomination.

When enabled, cash rounding is applied to the [Cart](/search.md?urn=ctp:api:type:Cart) `taxedPrice.totalGross`, or to `totalPrice` if the price does not include taxes. If a price is affected by a Product Discount, the rounding is also reflected in the `discounted` field of prices.

### Taxes

#### Tax rate selection

The `shippingAddress.country` and `shippingAddress.state` properties affect the selection criteria. These are compared to the `TaxRate`'s `country` and `state` fields. A Tax Rate is only eligible if the `country` and `state` properties are an **exact match**.

Since the `state` field is optional on both `TaxRate` and `shippingAddress`, this means the following:

- If `shippingAddress.country` and `TaxRate.country` are an **exact match**, and no `state` properties are present, the `TaxRate` **applies** to the Cart.
- If `shippingAddress.country` and `TaxRate.country` are an **exact match**, but only one of `shippingAddress.state` or `TaxRate.state` is present, the Tax Rate **does not apply** to the Cart.
- If `shippingAddress.country` and `TaxRate.country` are an **exact match**, and `shippingAddress.state` and `TaxRate.state` are an **exact match**, the Tax Rate **applies** to the Cart.
- If `shippingAddress.country` and `TaxRate.country` are present, and `shippingAddress.state` and `TaxRate.state` are present, but there is a mismatch of either `country` or `state`, the Tax Rate **does not apply** to the Cart.

If you need to include a state or country sub-unit for shipping purposes, use `shippingAddress.region` to avoid Tax Rate conflicts.

#### Tax modes

By default, newly created Carts use the `Platform` [TaxMode](/search.md?urn=ctp:api:type:TaxMode). With this tax mode, the `taxedPrice` of a Cart is calculated automatically based on the Tax Rate that applies for the `country` (and optionally, `state`) of the Cart's `shippingAddress`. The Tax Rate is taken from the [TaxCategory](/search.md?urn=ctp:api:type:TaxCategory) assigned to Products and Shipping Methods.

If you prefer to have more control over how taxes are calculated in your Project, including the use of an external tax calculation service, you can use one of the following [TaxModes](/api/projects/carts.md#taxmode):

- `External`: you are responsible for explicitly setting the Tax Rates for Line Items and Custom Line Items. With this tax mode, you must specify whether tax is included in the price for Line Items or Custom Line Items. This mode is suitable when you want commercetools API to handle the tax calculations based on the provided Tax Rates.

- `ExternalAmount`: you are responsible for providing the exact tax amounts for Line Items and Custom Line Items, and explicitly setting the `taxedPrice` of the Cart using [Set Cart Total Tax](/api/projects/carts.md#set-cart-total-tax). This mode is suitable when you want full control over the tax calculation. For more information about how to set tax amounts, see [ExternalAmount TaxMode](/api/projects/carts.md#taxmode).

When `includedInPrice: true`, the tax is calculated in a top-down manner, and when `includedInPrice: false`, the tax is calculated in a bottom-up manner.

The following example shows the impact of `includedInPrice` in the Cart calculation with `taxRoundingMode: HalfEven` and `taxCalculationMode: LineItemLevel`.

| Line Item | Product Variant A | Product Variant B | Shipping |
| --- | --- | --- | --- |
| **Line Item: Price** | $15 | $25 | $5 |
| **Quantity** | 10 | 5 | --- |
| **External Tax Rate: includedInPrice** | false | true | false |
| **External Tax Rate: amount** | 0.19 | 0.15 | 0.15 |
| **Taxed Item Price: totalNet** | $150 | $108.70 | $5 |
| **Taxed Item Price: totalGross** | $178.5 | $125 | $5.75 |
| **Calculation formula** | 15 x 10 (1 + 0.19) | 25 x 5 / (1 + 0.15) | 5 x (1 + 0.15) |

#### Tax calculation mode

Due to the principle of rounding on every calculation step, this slight difference in when to apply tax can have a considerable effect on the Cart total.

Two tax calculation modes are available to support different use cases:

- The `LineItemLevel` [TaxCalculationMode](/search.md?urn=ctp:api:type:TaxCalculationMode) enforces tax calculation **after** multiplying the individual item price by the quantity.
- The `UnitPriceLevel` mode calculates the taxed price **before** multiplying by the quantity.

The following example demonstrates the differences in the Cart total depending on the different tax calculation modes. Let's assume:

- A tax of 19% is included in the price for all Line Items.
- The Cart's [TaxRoundingMode](/api/projects/carts.md#roundingmode) is `HalfEven`.
- The Cart's [price precision](/api/carts-orders-apis-overview.md#price-precision) is two decimals.

| Line Item # | Quantity | Unit Price | Line Item Total, Net(`LineItemLevel`) | Line Item Total, Net(`UnitPriceLevel`) | Line Item Total, Gross |
| --- | --- | ---: | ---: | ---: | ---: |
| 1 | 1 | $1.00 | $0.84 | $0.84 | $1.00 |
| 2 | 10 | $1.08 | $9.08 | $9.10 | $10.80 |
| 3 | 10 | $108.08 | $908.24 | $908.20 | $1080.80 |
| 4 | 1 | $2.00 | $1.68 | $1.68 | $2.00 |
| 5 | 50 | $0.01 | $0.42 | $0.50 | $0.50 |
| 6 | 1 | $4.90 | $4.12 | $4.12 | $4.90 |
|  |  |  | Cart Total, Net(`LineItemLevel`) | Cart Total, Net(`UnitPriceLevel`) | Cart Total, Gross |
|  |  |  | **$924.38** | **$924.44** | **$1100.00** |

As seen from the example, if a Line Item has a quantity of 1, the two modes have no impact on the total net value of a Line Item (see Line Item #1, 4, and 6).
However, if the quantity is more than 1, the two modes calculate the total net value of a Line Item with a difference of several cents (see Line Item #2, 3, and 5).

Depending on the specific Line Item values, the chosen mode can give a greater or lesser net value (see Line Item #2 compared to #3).
A difference of 6 cents is accumulated in the Cart total. The connection to rounding is especially clear with Line Item #5.

Due to rounding after applying tax to 0.01 and multiplying by quantity 50 upon that, the net value when using `UnitPriceLevel` ends up being equal to the gross value.
With `LineItemLevel`, where quantity multiplication is performed as a first calculation step, the rounding occurs to a greater value, and the net value ends up being $0.42.

### Create an Order

To create an Order from a Cart, see the [Create Order from Cart](/search.md?urn=ctp:api:endpoint:/{projectKey}/orders:POST), [Create Order in Store from Cart](/search.md?urn=ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/orders:POST), and [Create Order from Cart in Business Unit](/search.md?urn=ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST)   endpoints.

When an Order is created from a Cart, the Direct Discount coexistence setting (`directDiscountsIgnoreCartDiscounts`) is copied to the Order.

To create an Order from a Quote, see the [Quotes overview](/api/quotes-overview.md) and the [Create Order from Quote](/search.md?urn=ctp:api:endpoint:/{projectKey}/orders/quotes:POST), [Create Order in Store from Quote](/search.md?urn=ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/orders/quotes:POST), and [Create Order from Quote in Business Unit](/search.md?urn=ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/quotes:POST)   endpoints.

To import an Order, see the [Create Order by Import](/search.md?urn=ctp:api:endpoint:/{projectKey}/orders/import:POST) endpoint.

### Order Edits

The Order Edits API does not support tracking or reserving inventory. You can only create an Order Edit if the [InventoryMode](/search.md?urn=ctp:api:type:InventoryMode) of the Order and its [LineItems](/api/projects/carts.md#lineitem) is `None`.

#### Intended flow

The basic flow for an Order Edit:

1. **Create an OrderEdit**: Upon creation, the OrderEdit contains a reference to the target Order within the `resource` field; however, no data is copied between the entities. At this point, you can consider the OrderEdit to be a staging area to collect the proposed changes.

2. **Add the proposed changes**: Immediately upon adding the [update actions](/api/projects/orders.md#update-actions) to the OrderEdit, the `stagedActions` are run against the Order; a so-called dry run. As a response, the Order is returned as if the Order actions had been applied. This allows you to preview the changes and understand the impact on the total price of the Order. The response will also contain Messages which capture the changes applied to the Order. Dry runs are always performed against the latest version of the Order.

   > If the Order endpoint contains [API Extensions](/api/projects/api-extensions.md), they are also called during the dry run.

3. **Review the preview**: ensure a careful review of the preview takes place, as the Order always respects the current product catalog, price configuration, and promotions. For example, if an OrderEdit is made soon after Order placement, changes will likely be minimal. However, if more time has passed, price adjustments and expired promotions may significantly impact the Order.

   > We recommend that you review the Messages within the preview to understand the proposed changes. For example, the [OrderEditApplied](/search.md?urn=ctp:api:type:OrderEditApplied) Message details the before and after values of the net total, gross total, and tax portion.

4. **Apply the changes**: When you [apply an Order Edit](/api/projects/order-edits.md#apply-orderedit), the Order is recalculated using the same criteria listed under [Update a Cart](/api/carts-orders-apis-overview.md#update-a-cart). During recalculation, Discounts that have become invalid or are otherwise no longer applicable are removed. Only Discounts that are valid at the time of the Order Edit application are applied to the updated Order.

   The Order (not the OrderEdit) triggers the [OrderEditApplied](/search.md?urn=ctp:api:type:OrderEditApplied) Message, which contains both the original and the newly applied values. At this point, you can delete the Order Edit (if desired). [Deleting an Order Edit](/search.md?urn=ctp:api:endpoint:/{projectKey}/orders/edits/{id}:DELETE) does not affect the related Order.

For the REST endpoints used in this flow, see [Create OrderEdit](/api/projects/order-edits.md#create-orderedit), [Update OrderEdit by ID](/api/projects/order-edits.md#update-orderedit-by-id), and [Apply OrderEdit](/api/projects/order-edits.md#apply-orderedit).

#### State

To check the state of an Order Edit, use the `result` field.

```mermaid
flowchart TB

np[NotProcessed]
ap[Applied]
pf[PreviewFailure]
ps[PreviewSuccess]

	np --> ps & pf
	pf <--> ps
	ps --> ap
```

| State | Description |
| --- | --- |
| [NotProcessed](/api/projects/order-edits.md#orderedit-notprocessed) | The changes have not been applied to the Order. This status shows on results returned from the [Query OrderEdits](/search.md?urn=ctp:api:endpoint:/{projectKey}/orders/edits:GET) endpoint. |
| [PreviewSuccess](/api/projects/order-edits.md#orderedit-previewsuccess) | A preview of the modified Order, including any available Messages, is available for evaluation. This status can show after OrderEdit creation and when an OrderEdit is fetched or updated via key or ID. |
| [PreviewFailure](/api/projects/order-edits.md#orderedit-previewfailure) | A preview could not be generated due to one or more invalid changes specified in the `errors` field. This status can show after OrderEdit creation and when an OrderEdit is fetched or updated via key or ID. |
| [Applied](/api/projects/order-edits.md#orderedit-applied) | The changes have been applied to the Order. This state contains information detailing the state before (`excerptBeforeEdit`) and after (`excerptAfterEdit`) the OrderEdit was applied. Once applied, any additional changes must be done in a new OrderEdit. |

### Order Search

The Order Search feature is intended for merchants to perform searches on a large number of Orders in a Project.

This feature is **not** intended for searching through a customer's order history in a storefront application.
The Order Search API does not return the resource data of the matching Orders. Instead, it returns a list of Order IDs, which can then be used to fetch the [Orders by their ID](/search.md?urn=ctp:api:endpoint:/{projectKey}/orders/{id}:GET).

Since the [response](/search.md?urn=ctp:api:type:Hit) also contains the version of the matching Order, it allows you to:

- maintain a cache of Orders,
- compare version numbers to detect outdated Orders,
- detect if the search index for an Order is out of date and react accordingly (for example display a warning, or [initiate an update](/api/projects/order-search.md#initiate-update) of the Order search index).

## Overview of update actions for Cart, Order, and Order Edit

The following tables group update actions by the resource they affect and show their availability for Carts, Orders, and Order Edits.

### Identifiers and Custom Fields

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Set Key | [✓](/api/projects/carts.md#set-key) | - | [✓](/api/projects/order-edits.md#set-key) |
| Set Order Number | - | [✓](/api/projects/orders.md#set-order-number) | [✓](/api/projects/order-edits.md#set-order-number) |
| Set Purchase Order Number | [✓](/api/projects/carts.md#set-purchase-order-number) | [✓](/api/projects/orders.md#set-purchase-order-number) | [✓](/api/projects/order-edits.md#set-purchase-order-number) |
| Set Custom Type | [✓](/api/projects/carts.md#set-custom-type) | [✓](/api/projects/orders.md#set-custom-type) | [✓](/api/projects/order-edits.md#set-custom-type) |
| Set CustomField | [✓](/api/projects/carts.md#set-customfield) | [✓](/api/projects/orders.md#set-customfield) | [✓](/api/projects/order-edits.md#set-customfield) |

### Customer and Business Unit

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Set Customer ID | [✓](/api/projects/carts.md#set-customer-id) | [✓](/api/projects/orders.md#set-customer-id) | [✓](/api/projects/order-edits.md#set-customer-id) |
| Set Customer Email | [✓](/api/projects/carts.md#set-customer-email) | [✓](/api/projects/orders.md#set-customer-email) | [✓](/api/projects/order-edits.md#set-customer-email) |
| Set Customer Group | [✓](/api/projects/carts.md#set-customer-group) | - | [✓](/api/projects/order-edits.md#set-customer-group) |
| Set Anonymous ID | [✓](/api/projects/carts.md#set-anonymous-id) | - | - |
| Set Business Unit | [✓](/api/projects/carts.md#set-business-unit) | [✓](/api/projects/orders.md#set-business-unit) | [✓](/api/projects/order-edits.md#set-business-unit) |

### Payments

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Add Payment | [✓](/api/projects/carts.md#add-payment) | [✓](/api/projects/orders.md#add-payment) | [✓](/api/projects/order-edits.md#add-payment) |
| Remove Payment | [✓](/api/projects/carts.md#remove-payment) | [✓](/api/projects/orders.md#remove-payment) | [✓](/api/projects/order-edits.md#remove-payment) |
| Change PaymentState | - | [✓](/api/projects/orders.md#change-paymentstate) | [✓](/api/projects/order-edits.md#change-paymentstate) |

### Locale and Store

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Set Locale | [✓](/api/projects/carts.md#set-locale) | [✓](/api/projects/orders.md#set-locale) | [✓](/api/projects/order-edits.md#set-locale) |
| Set Country | [✓](/api/projects/carts.md#set-country) | - | [✓](/api/projects/order-edits.md#set-country) |
| Set Store | - | [✓](/api/projects/orders.md#set-store) | [✓](/api/projects/order-edits.md#set-store) |

### Lifecycle and workflow

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Set DeleteDaysAfterLastModification | [✓](/api/projects/carts.md#set-deletedaysafterlastmodification) | - | - |
| Freeze Cart | [✓](/api/projects/carts.md#freeze-cart) | - | - |
| Unfreeze Cart | [✓](/api/projects/carts.md#unfreeze-cart) | - | - |
| Lock Cart | [✓](/api/projects/carts.md#lock-cart) | - | - |
| Unlock Cart | [✓](/api/projects/carts.md#unlock-cart) | - | - |
| Recalculate | [✓](/api/projects/carts.md#recalculate) | - | - |
| Change OrderState | - | [✓](/api/projects/orders.md#change-orderstate) | [✓](/api/projects/order-edits.md#change-orderstate) |
| Transition State | - | [✓](/api/projects/orders.md#transition-state) | [✓](/api/projects/order-edits.md#transition-state) |
| Update SyncInfo | - | [✓](/api/projects/orders.md#update-syncinfo) | [✓](/api/projects/order-edits.md#update-syncinfo) |

### on ShoppingList

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Add Shopping List | [✓](/api/projects/carts.md#add-shopping-list) | - | [✓](/api/projects/order-edits.md#add-shopping-list) |

### on Tax

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Set Cart Total Tax | [✓](/api/projects/carts.md#set-cart-total-tax) | - | - |
| Set Order Total Tax | - | - | [✓](/api/projects/order-edits.md#set-order-total-tax) |
| Change TaxMode | [✓](/api/projects/carts.md#change-taxmode) | - | [✓](/api/projects/order-edits.md#change-taxmode) |
| Change Price RoundingMode | [✓](/api/projects/carts.md#change-price-roundingmode) | - | [✓](/api/projects/order-edits.md#change-price-roundingmode) |
| Change Tax RoundingMode | [✓](/api/projects/carts.md#change-tax-roundingmode) | - | [✓](/api/projects/order-edits.md#change-tax-roundingmode) |
| Change Tax CalculationMode | [✓](/api/projects/carts.md#change-taxcalculationmode) | - | [✓](/api/projects/order-edits.md#change-taxcalculationmode) |

### on DiscountCode

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Add DiscountCode | [✓](/api/projects/carts.md#add-discountcode) | - | [✓](/api/projects/order-edits.md#add-discountcode) |
| Remove DiscountCode | [✓](/api/projects/carts.md#remove-discountcode) | - | [✓](/api/projects/order-edits.md#remove-discountcode) |

### on DirectDiscount

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Set DirectDiscounts | [✓](/api/projects/carts.md#set-directdiscounts) | - | [✓](/api/projects/order-edits.md#set-directdiscounts) |
| Set DirectDiscountsIgnoreCartDiscounts | [✓](/api/projects/carts.md#set-directdiscountsignorecartdiscounts) | - | [✓](/api/projects/order-edits.md#set-directdiscountsignorecartdiscounts) |

### on LineItem

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Add LineItem | [✓](/api/projects/carts.md#add-lineitem) | - | [✓](/api/projects/order-edits.md#add-lineitem) |
| Remove LineItem | [✓](/api/projects/carts.md#remove-lineitem) | - | [✓](/api/projects/order-edits.md#remove-lineitem) |
| Change LineItem Quantity | [✓](/api/projects/carts.md#change-lineitem-quantity) | - | [✓](/api/projects/order-edits.md#change-lineitem-quantity) |
| Change LineItems Order | [✓](/api/projects/carts.md#change-lineitems-order) | - | - |
| Set LineItem TaxRate | [✓](/api/projects/carts.md#set-lineitem-taxrate) | - | [✓](/api/projects/order-edits.md#set-lineitem-taxrate) |
| Set LineItem TaxAmount | [✓](/api/projects/carts.md#set-lineitem-taxamount) | - | [✓](/api/projects/order-edits.md#set-lineitem-taxamount) |
| Set LineItem Price | [✓](/api/projects/carts.md#set-lineitem-price) | - | [✓](/api/projects/order-edits.md#set-lineitem-price) |
| Set LineItem TotalPrice | [✓](/api/projects/carts.md#set-lineitem-totalprice) | - | [✓](/api/projects/order-edits.md#set-lineitem-totalprice) |
| Set LineItem DistributionChannel | [✓](/api/projects/carts.md#set-lineitem-distributionchannel) | - | [✓](/api/projects/order-edits.md#set-lineitem-distributionchannel) |
| Set LineItem ShippingDetails | [✓](/api/projects/carts.md#set-lineitem-shippingdetails) | [✓](/api/projects/orders.md#set-lineitem-shippingdetails) | [✓](/api/projects/order-edits.md#set-lineitem-shippingdetails) |
| Set LineItemRecurrenceInfo | [✓](/api/projects/carts.md#set-lineitemrecurrenceinfo) | - | - |
| Apply DeltaToLineItemShippingDetailTargets | [✓](/api/projects/carts.md#apply-deltatolineitemshippingdetailstargets) | - | - |
| Set LineItem Custom Type | [✓](/api/projects/carts.md#set-lineitem-custom-type) | [✓](/api/projects/orders.md#set-lineitem-custom-type) | [✓](/api/projects/order-edits.md#set-lineitem-custom-type) |
| Set LineItem CustomField | [✓](/api/projects/carts.md#set-lineitem-customfield) | [✓](/api/projects/orders.md#set-lineitem-customfield) | [✓](/api/projects/order-edits.md#set-lineitem-customfield) |
| Set LineItem InventoryMode | [✓](/api/projects/carts.md#set-lineitem-inventorymode) | - | - |
| Set LineItem SupplyChannel | [✓](/api/projects/carts.md#set-lineitem-supplychannel) | - | - |
| Transition LineItem State | - | [✓](/api/projects/orders.md#transition-lineitem-state) | [✓](/api/projects/order-edits.md#transition-lineitem-state) |
| Import LineItem State | - | [✓](/api/projects/orders.md#import-lineitem-state) | [✓](/api/projects/order-edits.md#import-lineitem-state) |

### on CustomLineItem

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Add CustomLineItem | [✓](/api/projects/carts.md#add-customlineitem) | - | [✓](/api/projects/order-edits.md#add-customlineitem) |
| Remove CustomLineItem | [✓](/api/projects/carts.md#remove-customlineitem) | - | [✓](/api/projects/order-edits.md#remove-customlineitem) |
| Change CustomLineItem Quantity | [✓](/api/projects/carts.md#change-customlineitem-quantity) | - | [✓](/api/projects/order-edits.md#change-customlineitem-quantity) |
| Set CustomLineItem TaxRate | [✓](/api/projects/carts.md#set-customlineitem-taxrate) | - | [✓](/api/projects/order-edits.md#set-customlineitem-taxrate) |
| Set CustomLineItem TaxAmount | [✓](/api/projects/carts.md#set-customlineitem-taxamount) | - | [✓](/api/projects/order-edits.md#set-customlineitem-taxamount) |
| Change CustomLineItem Money | [✓](/api/projects/carts.md#change-customlineitem-money) | - | [✓](/api/projects/order-edits.md#change-customlineitem-money) |
| Change CustomLineItem Price Mode | [✓](/api/projects/carts.md#change-customlineitem-price-mode) | - | - |
| Set CustomLineItem ShippingDetails | [✓](/api/projects/carts.md#set-customlineitem-shippingdetails) | [✓](/api/projects/orders.md#set-customlineitem-shippingdetails) | [✓](/api/projects/order-edits.md#set-customlineitem-shippingdetails) |
| Set CustomLineItemRecurrenceInfo | [✓](/api/projects/carts.md#set-customlineitemrecurrenceinfo) | - | - |
| Apply DeltaToCustomLineItemShippingDetailsTargets | [✓](/api/projects/carts.md#apply-deltatocustomlineitemshippingdetailstargets) | - | - |
| Set CustomLineItem Custom Type | [✓](/api/projects/carts.md#set-customlineitem-custom-type) | [✓](/api/projects/orders.md#set-customlineitem-custom-type) | [✓](/api/projects/order-edits.md#set-customlineitem-custom-type) |
| Set CustomLineItem CustomField | [✓](/api/projects/carts.md#set-customlineitem-customfield) | [✓](/api/projects/orders.md#set-customlineitem-customfield) | [✓](/api/projects/order-edits.md#set-customlineitem-customfield) |
| Transition CustomLineItem State | - | [✓](/api/projects/orders.md#transition-customlineitem-state) | [✓](/api/projects/order-edits.md#transition-customlineitem-state) |
| Import CustomLineItem State | - | [✓](/api/projects/orders.md#import-customlineitem-state) | [✓](/api/projects/order-edits.md#import-customlineitem-state) |

### on Billing Address

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Set Billing Address | [✓](/api/projects/carts.md#set-billing-address) | [✓](/api/projects/orders.md#set-billing-address) | [✓](/api/projects/order-edits.md#set-billing-address) |
| Set Billing Address Custom Type | [✓](/api/projects/carts.md#set-billing-address-custom-type) | [✓](/api/projects/orders.md#set-billing-address-custom-type) | [✓](/api/projects/order-edits.md#set-billing-address-custom-type) |
| Set Billing Address CustomField | [✓](/api/projects/carts.md#set-billing-address-customfield) | [✓](/api/projects/orders.md#set-billing-address-customfield) | [✓](/api/projects/order-edits.md#set-billing-address-customfield) |

### on Shipping Address

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Set Shipping Address | [✓](/api/projects/carts.md#set-shipping-address) | [✓](/api/projects/orders.md#set-shipping-address) | [✓](/api/projects/order-edits.md#set-shipping-address) |
| Set Shipping Address Custom Type | [✓](/api/projects/carts.md#set-shipping-address-custom-type) | [✓](/api/projects/orders.md#set-shipping-address-custom-type) | [✓](/api/projects/order-edits.md#set-shipping-address-custom-type) |
| Set Shipping Address CustomField | [✓](/api/projects/carts.md#set-shipping-address-customfield) | [✓](/api/projects/orders.md#set-shipping-address-customfield) | [✓](/api/projects/order-edits.md#set-shipping-address-customfield) |

### on ItemShipping Address

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Add ItemShippingAddress | [✓](/api/projects/carts.md#add-itemshippingaddress) | [✓](/api/projects/orders.md#add-itemshippingaddress) | [✓](/api/projects/order-edits.md#add-itemshippingaddress) |
| Remove ItemShippingAddress | [✓](/api/projects/carts.md#remove-itemshippingaddress) | [✓](/api/projects/orders.md#remove-itemshippingaddress) | [✓](/api/projects/order-edits.md#remove-itemshippingaddress) |
| Update ItemShippingAddress | [✓](/api/projects/carts.md#update-itemshippingaddress) | [✓](/api/projects/orders.md#update-itemshippingaddress) | [✓](/api/projects/order-edits.md#update-itemshippingaddress) |
| Set ItemShipping Address Custom Type | [✓](/api/projects/carts.md#set-itemshipping-address-custom-type) | [✓](/api/projects/orders.md#set-itemshipping-address-custom-type) | [✓](/api/projects/order-edits.md#set-itemshipping-address-custom-type) |
| Set ItemShipping Address CustomField | [✓](/api/projects/carts.md#set-itemshipping-address-customfield) | [✓](/api/projects/orders.md#set-itemshipping-address-customfield) | [✓](/api/projects/order-edits.md#set-itemshipping-address-customfield) |

### on ShippingMethod

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Add ShippingMethod | [✓](/api/projects/carts.md#add-shippingmethod) | - | - |
| Add Custom ShippingMethod | [✓](/api/projects/carts.md#add-custom-shippingmethod) | - | - |
| Remove Shipping Method | [✓](/api/projects/carts.md#remove-shippingmethod) | - | - |
| Set ShippingMethod | [✓](/api/projects/carts.md#set-shippingmethod) | - | [✓](/api/projects/order-edits.md#set-shippingmethod) |
| Set ShippingAddress and ShippingMethod | - | - | [✓](/api/projects/order-edits.md#set-shippingaddress-and-shippingmethod) |
| Set ShippingAddress and Custom ShippingMethod | - | - | [✓](/api/projects/order-edits.md#set-shippingaddress-and-custom-shippingmethod) |
| Set Custom ShippingMethod | [✓](/api/projects/carts.md#set-custom-shippingmethod) | - | [✓](/api/projects/order-edits.md#set-custom-shippingmethod) |
| Set ShippingRateInput | [✓](/api/projects/carts.md#set-shippingrateinput) | - | [✓](/api/projects/order-edits.md#set-shippingrateinput) |
| Set ShippingMethod TaxAmount | [✓](/api/projects/carts.md#set-shippingmethod-taxamount) | - | [✓](/api/projects/order-edits.md#set-shippingmethod-taxamount) |
| Set ShippingMethod TaxRate | [✓](/api/projects/carts.md#set-shippingmethod-taxrate) | - | [✓](/api/projects/order-edits.md#set-shippingmethod-taxrate) |

### on Shipping

| Update action | Cart | Order | Order Edit |
| --- | :---: | :---: | :---: |
| Set Shipping Custom Type | [✓](/api/projects/carts.md#set-shipping-custom-type) | [✓](/api/projects/orders.md#set-shipping-custom-type) | [✓](/api/projects/order-edits.md#set-shipping-custom-type) |
| Set Shipping CustomField | [✓](/api/projects/carts.md#set-shipping-customfield) | [✓](/api/projects/orders.md#set-shipping-customfield) | [✓](/api/projects/order-edits.md#set-shipping-customfield) |

### on Delivery

| Update action | Cart | Order | Order Edit |
| --------------------------- | :--: | :------------------------------------------------------: | :-----------------------------------------------------------: |
| Add Delivery | - | [✓](/api/projects/orders.md#add-delivery) | [✓](/api/projects/order-edits.md#add-delivery) |
| Remove Delivery | - | [✓](/api/projects/orders.md#remove-delivery) | [✓](/api/projects/order-edits.md#remove-delivery) |
| Change ShipmentState | - | [✓](/api/projects/orders.md#change-shipmentstate) | [✓](/api/projects/order-edits.md#change-shipmentstate) |
| Set Delivery Address | - | [✓](/api/projects/orders.md#set-delivery-address) | [✓](/api/projects/order-edits.md#set-delivery-address) |
| Add Parcel to Delivery | - | [✓](/api/projects/orders.md#add-parcel-to-delivery) | [✓](/api/projects/order-edits.md#add-parcel-to-delivery) |
| Remove Parcel from Delivery | - | [✓](/api/projects/orders.md#remove-parcel-from-delivery) | [✓](/api/projects/order-edits.md#remove-parcel-from-delivery) |
| Set Delivery Items | - | [✓](/api/projects/orders.md#set-delivery-items) | [✓](/api/projects/order-edits.md#set-delivery-items) |
| Set Delivery Custom Type | - | [✓](/api/projects/orders.md#set-delivery-custom-type) | [✓](/api/projects/order-edits.md#set-delivery-custom-type) |
| Set Delivery CustomField | - | [✓](/api/projects/orders.md#set-delivery-customfield) | [✓](/api/projects/order-edits.md#set-delivery-customfield) |

### on Delivery Address

| Update action | Cart | Order | Order Edit |
| -------------------------------- | :--: | :-----------------------------------------------------------: | :----------------------------------------------------------------: |
| Set Delivery Address Custom Type | - | [✓](/api/projects/orders.md#set-delivery-address-custom-type) | [✓](/api/projects/order-edits.md#set-delivery-address-custom-type) |
| Set Delivery Address CustomField | - | [✓](/api/projects/orders.md#set-delivery-address-customfield) | [✓](/api/projects/order-edits.md#set-delivery-address-customfield) |

### on Parcel

| Update action | Cart | Order | Order Edit |
| ------------------------ | :--: | :---------------------------------------------------: | :--------------------------------------------------------: |
| Set Parcel Measurements | - | [✓](/api/projects/orders.md#set-parcel-measurements) | [✓](/api/projects/order-edits.md#set-parcel-measurements) |
| Set Parcel Tracking Data | - | [✓](/api/projects/orders.md#set-parcel-tracking-data) | [✓](/api/projects/order-edits.md#set-parcel-tracking-data) |
| Set Parcel Items | - | [✓](/api/projects/orders.md#set-parcel-items) | [✓](/api/projects/order-edits.md#set-parcel-items) |
| Set Parcel Custom Type | - | [✓](/api/projects/orders.md#set-parcel-custom-type) | [✓](/api/projects/order-edits.md#set-parcel-custom-type) |
| Set Parcel CustomField | - | [✓](/api/projects/orders.md#set-parcel-customfield) | [✓](/api/projects/order-edits.md#set-parcel-customfield) |

### on ReturnItem

| Update action | Cart | Order | Order Edit |
| -------------------------- | :--: | :-----------------------------------------------------: | :----------------------------------------------------------: |
| Add ReturnInfo | - | [✓](/api/projects/orders.md#add-returninfo) | [✓](/api/projects/order-edits.md#add-returninfo) |
| Set ReturnInfo | - | [✓](/api/projects/orders.md#set-returninfo) | [✓](/api/projects/order-edits.md#set-returninfo) |
| Set ReturnShipmentState | - | [✓](/api/projects/orders.md#set-returnshipmentstate) | [✓](/api/projects/order-edits.md#set-returnshipmentstate) |
| Set ReturnPaymentState | - | [✓](/api/projects/orders.md#set-returnpaymentstate) | [✓](/api/projects/order-edits.md#set-returnpaymentstate) |
| Set ReturnItem Custom Type | - | [✓](/api/projects/orders.md#set-returnitem-custom-type) | [✓](/api/projects/order-edits.md#set-returnitem-custom-type) |
| Set ReturnItem CustomField | - | [✓](/api/projects/orders.md#set-returnitem-customfield) | [✓](/api/projects/order-edits.md#set-returnitem-customfield) |

## Limits

A maximum of **10000000** Carts can be added to a Project. After this limit is reached, the [automatic cleanup task](/api/general-concepts.md#automatic-cleanup) deletes Carts based on their retention period. This is a soft limit that can be increased per Project after a performance impact review. See [Limit increase guidance](/api/limit-increase-guidance.md#resource-count-limits).

A Shopping List can contain up to **250** Line Items and up to **100** Text Line Items.
The maximum number of Shopping Lists that can be added to a Project is **10000000**. After this limit is reached, the [automatic cleanup task](/api/general-concepts.md#automatic-cleanup) deletes Shopping Lists based on their retention period. This is a soft limit that can be increased per Project after a performance impact review. See [Limit increase guidance](/api/limit-increase-guidance.md#resource-count-limits).

A Customer or Associate can have up to **50** active and **100** inactive PaymentMethods. A Project can contain up to **1000000** PaymentMethods that are not assigned to a Customer or Associate.

A maximum of **100000** OrderEdits can exist per [Project](/api/projects/project.md). This is a soft limit that can be increased per Project after a performance impact review. See [Limit increase guidance](/api/limit-increase-guidance.md#resource-count-limits).

> Only Orders from the last **3 months** are indexed for Order Search and can be retrieved.

## Related pages

- [Area overview page with navigation](/api.md)
- [Previous page: Overview](/api/carts-orders-overview.md)
- [Next page: Carts](/api/projects/carts.md)
- [Search documentation and API specs](/search.md)