Use Field Mappers to Add Custom Fields in the Cart Document

Add custom fields to the cart document using field mapping. After you create the custom field for Order or OrderItem sObjects, you can map them to a key in cart document. Since the key is the internal representation of the custom field in the cart document, it doesn't requirea namespace or "**c". When value for a custom field will be updated using cart document wrapper, this mapping will be used to get the key in cart document and the corresponding node will be updated with the value. Similarly, this mapping will be used to create response (external representation, containing namespace prefix and "**c") from the internal cart document.

Example sample mapping record:

Sample Mapping Record

If a new custom field is created on OrderItem then a mapping record for the field should also be created. To create a new mapping.

  1. From Setup, in the Quick Find box, enter Custom Settings, and then select Custom Settings.
  2. Next to Custom Field Maps, click Manage.
  3. Click New and enter the details for your mapping record.