Map Cart Data to Order Data
During checkout, B2B Commerce and D2C Commerce create orders and order summaries using information from the cart. Many fields in the cart map to order fields and to order summary fields. In addition, fields in other order-related objects are mapped to fields in various other objects, including cart-related objects. If you understand how the various fields are mapped, you can plan accordingly. Also, if you follow certain patterns, you can ensure that custom fields are mapped successfully.
Several objects hold cart-related data and order-related data. We describe which fields are required to create an order record and an order summary record. We also indicate how the fields of order-related objects map to other fields.
Starting in Spring ‘23, the Cart to Order action supports the automatic mapping of custom fields if you follow certain patterns.
To be mapped successfully, a custom field must exist in the Cart, Order, and OrderSummary objects. It can also optionally exist in the OrderAdjustmentGroup, OrderDeliveryGroup, OrderItem, OrderItemAdjustmentLineItem, and OrderItemTaxLineItem objects.
Across all of these objects, the custom field must have the same API name, same data type, and same field configuration (length, precision, field-level security, and so on). The data type of the field must be one of the following:
- Checkbox
- Currency
- Date
- DateTime
- Html
- LongTextArea
- Number
- Percent
- Phone
- Text
- TextArea
- Url
If the system finds a custom field that matches across these objects, the field is automatically mapped.
The following tables list fields for order-related objects. The tables don’t show a comprehensive list of all fields for each object. However, the tables do include all fields that must be populated to create an order record or an order summary record. The tables also show information about other fields whose values are mapped to other objects.
When an order field is populated, or mapped, the system copies the value from a cart object and inserts it into the order object without modification. If you want to import orders from an external system, use this information to determine which fields are necessary for a functional checkout.
- If a field is denoted with the
*Generated at runtime
value, the value of the field is unique and generated when the record is created. - If a field is denoted with
*Provided by shipping integration
, the values can also be provided using your shipping integration. For an example, see our sample shipping integration.
Order Field | Required for Order Summaries | Required for Orders | Field Type | Value |
---|---|---|---|---|
Id | Yes | Yes | EntityId | *Generated at runtime |
AccountId | No | Yes | EntityId | WebCart.AccountId |
EffectiveDate | Yes | Yes | Date | CreatedDate |
BillingCity | No | No | Address | WebCart.BillingCity |
BillingCountry | No | No | Address | WebCart.BillingCountry |
BillingEmailAddress | No | No | WebCart.GuestEmailAddress | |
BillingLatitude | No | No | Address | WebCart.BillingLatitude |
BillingLongitude | No | No | Address | WebCart.BillingLongitude |
BillingPhoneNumber | No | No | Phone | WebCart.GuestPhoneNumber |
BillingPostalCode | No | No | Address | WebCart.BillingPostalCode |
BillingStreet | No | No | Address | WebCart.BillingStreet |
BillingState | No | No | Address | WebCart.BillingState |
CurrencyIsoCode | Yes | Yes | CurrencyCode | WebCart.CurrencyIsoCodeThis field is only required if MultiCurrency is enabled. |
OrderedDate | No | No | DateTime | CreatedDate |
OwnerId | No | Yes | Reference | WebCart.OwnerId |
PoNumber | No | No | String | Collected at checkout. |
SalesStore | No | Yes | EntityId | WebCart.WebStoreId |
Status | Yes | Yes | DynamicEnum | Draft |
TaxLocaleType | Yes | Yes | EntityId | WebCart.TaxType |
OrderItem Field | Required for Order Summaries | Required for Orders | Field Type | Value |
---|---|---|---|---|
GrossUnitPrice | Yes | Yes | Currency | WebCart.GrossUnitPrice |
Id | Yes | Yes | EntityId | *Generated at runtime |
OrderId | Yes | Yes | EntityId | Order.Id |
OrderDeliveryGroupId | Yes | No | EntityId | ID of OrderDeliveryGroupCartItem.CartDeliveryGroupId points to the CartDeliveryGroup, which is used to create an OrderDeliveryGroup. |
Product2Id | Yes | Yes | EntityId | CartItem.Product2Id |
Quantity | Yes | Yes | Double | CartItem.Quantity |
TotalLineAmount | No | Yes | Currency | CartItem.TotalLineAmount, TotalLineNetAmount |
Type | No | Yes | Picklist | CartItem.Type
|
UnitPrice | Yes | Yes | Currency | CartItem.SalesPrice or CartItem.ListPrice if SalesPrice is empty, NetUnitPrice |
ListPrice | No | No | Currency | CartItem.ListPrice or CartItem.SalesPrice if ListPrice is empty. |
OrderDeliveryGroup Field | Required for Order Summaries | Required for Orders | Field Type | Value |
---|---|---|---|---|
Id | Yes | Yes | EntityId | *Generated at runtime |
DeliverToStreet | No | No | Address | CartDeliveryGroup.DeliverToStreet |
DeliverToCity | No | No | Address | CartDeliveryGroup.DeliverToCity |
DeliverToState | No | No | Address | CartDeliveryGroup.DeliverToState |
DeliverToPostalCode | No | No | Address | CartDeliveryGroup.DeliverToPostalCode |
DeliverToCountry | No | No | Address | CartDeliveryGroup.DeliverToCountry |
DeliverToLatitude | No | No | Address | CartDeliveryGroup.DeliverToLatitude |
DeliverToLongitude | No | No | Address | CartDeliveryGroup.DeliverToLongitude |
DeliveryInstructions | No | No | TextArea | CartDeliveryGroup.ShippingInstructions |
DesiredDeliveryDate | No | No | Date | CartDeliveryGroup.DesiredDeliveryDate |
DeliveryMethodId | Yes | Yes | EntityId | CartDeliveryGroup.OrderDeliveryMethodId |
OrderId | Yes | Yes | EntityId | Order.Id |
DeliverToName | Yes | Yes | Text | CartDeliveryGroup.DeliverToNameDefaults to “Deliver To” |
OrderItemAdjustmentLineItem Field | Required for Order Summaries | Required for Orders | Field Type | Value |
---|---|---|---|---|
Id | Yes | Yes | EntityId | *Generated at runtime |
Amount | Yes | Yes | Currency | CartItem.NetAdjustmentAmount |
Name | No | Yes | Text | “Price Adjustment” |
OrderItemId | Yes | Yes | EntityId | OrderItem.Id |
When you enable promotions, the following OrderItemAdjustmentLineItem fields are also mapped.
The Amount and Name fields are mapped from a different source than when promotions are disabled
OrderItemAdjustmentLineItem Field | Required for Order Summaries | Required for Orders | Field Type | Value |
---|---|---|---|---|
AdjustmentCause | No | No | EntityId | CartItemPriceAdjustment.PriceAdjustmentCause |
Amount | Yes | Yes | Currency | CartItemPriceAdjustment.TotalAmount, TotalNetAmount |
Description | No | No | TextArea | CartItemPriceAdjustment.Description |
Name | No | Yes | Text | CartItemPriceAdjustment.Name |
OrderAdjustmentGroup | No | No | EntityId | CartItemPriceAdjustment.WebCartAdjustmentGrup |
Priority | No | No | Integer | CartItemPriceAdjustment.Priority |
OrderItemTaxLineItem Field | Required for Order Summaries | Required for Orders | Field Type | Value |
---|---|---|---|---|
Id | Yes | Yes | EntityId | *Generated at runtime |
Amount | Yes | Yes | Currency | CartTax.Amount or CartItem.AdjustmentTaxAmount if this field contains a tax adjustment. |
Name | Yes | Yes | Text | CartTax.Name or "Tax Adjustment" if field contains a tax adjustment. |
OrderItemId | Yes | Yes | EntityId | Orderitem.Id |
OrderItemAdjustment LineItem | No | No | EntityId |
|
TaxEffectiveDate | Yes | Yes | Date | CartTax.TaxCalculationDate or a past date if TaxEffectiveDate is empty. If this field contains a tax adjustment, it’s the current date. |
Type | Yes | Yes | StaticEnum | CartTax.TaxType or "Estimated" if this field contains a tax adjustment. |
Rate | No | No | Percent | CartTax.TaxRate or empty if this field contains a tax adjustment. |
Description | No | No | Text | CartTax.Description or empty if this field contains a tax adjustment. |
The OrderAdjustmentGroup object is available only when you enable promotions.
OrderAdjustmentGroup Field | Required for Order Summaries | Required for Orders | Field Type | Value |
---|---|---|---|---|
Id | No | No | EntityId | *Generated at runtime |
Description | No | No | TextArea | WebCartAdjustmentGroup.Description |
Name | No | Yes | Text | WebCartAdjustmentGroup.Name |
OrderId | No | Yes | EntityId | Order.id |
AdjustmentCause | No | No | EntityId | WebCartAdjustmentGroup.PriceAdjustmentCause |
Type | No | No | Picklist | WebCartAdjustmentGroup.AdjustmentTargetType |
See Also