Add Items to Cart

Add items to the cart along with any required child products that are specified in the request body. Compatibility and pricing rules are run against the cart.

You must use the fieldsToUpdate parameter to update any default line item value.

Add line items to cart replaces the OmniCPQServiceWrapper addProducts method.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User Technical Details.

For additional information, ​see UserSecurity Class and CPQ and Digital Commerce Changes for Guest Users.

When you add child items to the cart:

  • Specify a parentRecord node in the input request.

  • In the parentRecord node, specify the productHierarchyPath field.

  • If the immediate parent of the child item that you're adding is a virtual parent, then also include these fields:

    • The Id field in the parentRecord node. Ensure that it's the PricebookEntryId of the immediate virtual parent.

    • The parentId field in the items node. Ensure that it's the lineItemId of the immediate real parent.

In releases prior to CME Spring '20, the postCartsItems method supports the addition of one item at a time. If you must add multiple items, make multiple postCartsItems calls.

With CME Spring '20 and later releases, the itemId parameter supports multiple comma-separated values when adding root and child items via postCartsItems method calls if UOWMode is set to true.

Communication (vlocity_cmt)

For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Response FormatJSON
Resource URL/services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items

For more information about levelBasedApproach, see Configuring Cart Item Refresh Levels.

To use this API to pass child line items, you must also specify the Price Book Entry ID.

An entire result can be thousands of lines long. This example has been truncated.