Remove Items from a Cart

The Delete Cart Items API (deleteCartsItems) removes one or more line items, stand-alone products, bundle members, auto-added promotions, or legacy asset rows, from a Cart (Quote/Order/Opportunity). Beyond the physical removal of rows, the call automatically:

  • Cascades through bundle hierarchies (removing empty parents).
  • Preserves or deletes promotions, depending on org policy.
  • Re-evaluates bundle cardinality and, optionally, full pricing and validation rules so totals remain consistent.
  • Returns deterministic success/error codes in a structured messages[] array.
  • CSR Dashboards / CPQ Console – Agents undo mis‑clicks in real time; pricing/validation flags are set to true to keep the UI totals trustworthy.
  • Self‑Service Portals – Shoppers remove add‑ons with price = false for latency; a later batch re‑prices the cart.
  • Guided Selling Swaps – OmniScript deletes an obsolete SKU, then immediately adds the successor product in the same transaction.
  • Nightly ETL Pruning – A middleware script processes 50 Ids at a time to guarantee all‑or‑nothing deletes.

UOWMode shield prevents half‑processed batches, either every Id is removed or none.

Built‑in guard rails ensure promotions remain fulfilled; or, when configured (DELETE_APPLIED_PROMO, DELETE_PROMO_ADDED_ITEMS), they’re cascaded out automatically.

Internal logic reruns min/max logic and aborts if bundle limits would be breached (returns code 302 on failure).

Flags let callers pay the CPU cost of Pricing/Validation only when needed.

Optional UseAssetReferenceIdForParentAndRoot switch allows "amend" journeys to address Assets even when the original Salesforce Ids have changed.

  • Hard Delete Only – The API performs disconnects which can’t be undone without an explicit add call.
  • Promotion Guard is Opinionated – If a delete would leave a promotion under‑fulfilled and DELETE_APPLIED_PROMO = false, the whole call fails with error 406.
  • Row Ownership – Items locked by an in‑flight pricing job (row‑level lock) will cause a retryable database exception; clients should implement exponential back‑off.
  • Partial Bundles – Deleting a parent without children Ids when collapse empty parents is disabled will result in orphan rows; ensure hierarchy handling settings ( hierarchy=-1) are correct.
ScenarioMedian LatencyNotes
1 Line, price=false< 300 msAvoids engine invocation.
10 Lines, price=true~1 sIncludes full Reprice + Advanced Rules.
50 Lines, batch + validate=false~1.2 sDocument layer bulk‑optimises DML.
  • Enforced by standard Salesforce CRUD/FLS on LineItem and Cart objects.
  • All writes run inside Queueable Apex context, inheriting the integration user’s profile and OWD.
  • The REST endpoint is covered by API Only User permission—lock down via named credentials for off‑platform integrations.

By default, items deleted from a cart are not evaluated for Vlocity Rules. To enable evaluation of deleted items, set the 'ShouldConsiderDeletedItems' custom setting to true.

Delete Items replaces the OmniCPQServiceWrapper deleteItem 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.

In releases prior to CME Spring '20, the deleteCartsItems method supports the deletion of one item at a time. If you must delete multiple items, make multiple deleteCartsItems calls. With CME Spring '20 and later releases, the itemId parameter supports multiple comma-separated values when deleting root and child items via deleteCartsItems 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?id={itemId}