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
  • Email
  • 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 FieldRequired for Order SummariesRequired for OrdersField TypeValue
IdYesYesEntityId*Generated at runtime
AccountIdNoYesEntityIdWebCart.AccountId
EffectiveDateYesYesDateCreatedDate
BillingCityNoNoAddressWebCart.BillingCity
BillingCountryNoNoAddressWebCart.BillingCountry
BillingEmailAddressNoNoEmailWebCart.GuestEmailAddress
BillingLatitudeNoNoAddressWebCart.BillingLatitude
BillingLongitudeNoNoAddressWebCart.BillingLongitude
BillingPhoneNumberNoNoPhoneWebCart.GuestPhoneNumber
BillingPostalCodeNoNoAddressWebCart.BillingPostalCode
BillingStreetNoNoAddressWebCart.BillingStreet
BillingStateNoNoAddressWebCart.BillingState
CurrencyIsoCodeYesYesCurrencyCodeWebCart.CurrencyIsoCode
 This field is only required if MultiCurrency is enabled.
OrderedDateNoNoDateTimeCreatedDate
OwnerIdNoYesReferenceWebCart.OwnerId
PoNumberNoNoStringCollected at checkout.
SalesStoreNoYesEntityIdWebCart.WebStoreId
StatusYesYesDynamicEnumDraft
TaxLocaleTypeYesYesEntityIdWebCart.TaxType

OrderItem FieldRequired for Order SummariesRequired for OrdersField TypeValue
GrossUnitPriceYesYesCurrencyWebCart.GrossUnitPrice
IdYesYesEntityId*Generated at runtime
OrderIdYesYesEntityIdOrder.Id
OrderDeliveryGroupIdYesNoEntityIdID of OrderDeliveryGroup
CartItem.CartDeliveryGroupId points to the CartDeliveryGroup, which is used to create an OrderDeliveryGroup.
Product2IdYesYesEntityIdCartItem.Product2Id
QuantityYesYesDoubleCartItem.Quantity
TotalLineAmountNoYesCurrencyCartItem.TotalLineAmount, TotalLineNetAmount
TypeNoYesPicklistCartItem.Type
 

Product and Charge are the only types allowed.

When CartItem.Type is set to Product, Order.Type is set to Order Product. When CartItem.Type is set to Charge, Order.Type is set to Delivery Charge.

UnitPriceYesYesCurrencyCartItem.SalesPrice or CartItem.ListPrice if SalesPrice is empty, NetUnitPrice
ListPriceNoNoCurrencyCartItem.ListPrice or CartItem.SalesPrice if ListPrice is empty.

OrderDeliveryGroup FieldRequired for Order SummariesRequired for OrdersField TypeValue
IdYesYesEntityId*Generated at runtime
DeliverToStreetNoNoAddressCartDeliveryGroup.DeliverToStreet
DeliverToCityNoNoAddressCartDeliveryGroup.DeliverToCity
DeliverToStateNoNoAddressCartDeliveryGroup.DeliverToState
DeliverToPostalCodeNoNoAddressCartDeliveryGroup.DeliverToPostalCode
DeliverToCountryNoNoAddressCartDeliveryGroup.DeliverToCountry
DeliverToLatitudeNoNoAddressCartDeliveryGroup.DeliverToLatitude
DeliverToLongitudeNoNoAddressCartDeliveryGroup.DeliverToLongitude
DeliveryInstructionsNoNoTextAreaCartDeliveryGroup.ShippingInstructions
DesiredDeliveryDateNoNoDateCartDeliveryGroup.DesiredDeliveryDate
DeliveryMethodIdYesYesEntityIdCartDeliveryGroup.OrderDeliveryMethodId
OrderIdYesYesEntityIdOrder.Id
DeliverToNameYesYesTextCartDeliveryGroup.DeliverToName
Defaults to β€œDeliver To”

OrderItemAdjustmentLineItem FieldRequired for Order SummariesRequired for OrdersField TypeValue
IdYesYesEntityId*Generated at runtime
AmountYesYesCurrencyCartItem.NetAdjustmentAmount
NameNoYesTextβ€œPrice Adjustment”
OrderItemIdYesYesEntityIdOrderItem.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 FieldRequired for Order SummariesRequired for OrdersField TypeValue
AdjustmentCauseNoNoEntityIdCartItemPriceAdjustment.PriceAdjustmentCause
AmountYesYesCurrencyCartItemPriceAdjustment.TotalAmount, TotalNetAmount
DescriptionNoNoTextAreaCartItemPriceAdjustment.Description
NameNoYesTextCartItemPriceAdjustment.Name
OrderAdjustmentGroupNoNoEntityIdCartItemPriceAdjustment.WebCartAdjustmentGrup
PriorityNoNoIntegerCartItemPriceAdjustment.Priority
OrderItemTaxLineItem FieldRequired for Order SummariesRequired for OrdersField TypeValue
IdYesYesEntityId*Generated at runtime
AmountYesYesCurrencyCartTax.Amount or CartItem.AdjustmentTaxAmount if this field contains a tax adjustment.
NameYesYesTextCartTax.Name or "Tax Adjustment" if field contains a tax adjustment.
OrderItemIdYesYesEntityIdOrderitem.Id
OrderItemAdjustment LineItemNoNoEntityId
  • OrderItemAdjustmentLineItem.Id, if this field contains a tax adjustment
  • CartTax.CartItemPriceAdjustment, if this field contains a tax adjustment and promotions are enabled
  • Otherwise, this field is empty.
TaxEffectiveDateYesYesDateCartTax.TaxCalculationDate or a past date if TaxEffectiveDate is empty. If this field contains a tax adjustment, it’s the current date.
TypeYesYesStaticEnumCartTax.TaxType or "Estimated" if this field contains a tax adjustment.
RateNoNoPercentCartTax.TaxRate or empty if this field contains a tax adjustment.
DescriptionNoNoTextCartTax.Description or empty if this field contains a tax adjustment.

The OrderAdjustmentGroup object is available only when you enable promotions.

OrderAdjustmentGroup FieldRequired for Order SummariesRequired for OrdersField TypeValue
IdNoNoEntityId*Generated at runtime
DescriptionNoNoTextAreaWebCartAdjustmentGroup.Description
NameNoYesTextWebCartAdjustmentGroup.Name
OrderIdNoYesEntityIdOrder.id
PromotionAdjustmentCauseNoNoEntityIdWebCartAdjustmentGroup.PriceAdjustmentCause
TypeNoNoPicklistWebCartAdjustmentGroup.AdjustmentTargetType

See Also