Delete Applied Promo Items

Overview

The Delete Applied Promotion API is a one-stop call that cleanly removes a promotion, and anything it added to the cart, in a single, safe step.

Why it matters

  • All-in-one cleanup – The moment the promotion is deleted, the API can also delete any free or discounted products the promo injected.
  • Automatic price correction – It immediately re-calculates totals, taxes, and recurring fees so the cart shows the real price after the promo is removed.
  • Rule protection – It re-runs the same product-compatibility and bundle rules that run at checkout, catching problems (like bundle-quantity minimums).
  • Atomic safety – Everything happens in one transaction. If any step fails, nothing is saved, so the cart is never left in a half-updated state.

What you send and what you get back

  • You pass the cart Id, the promotion Id (or a comma-separated list), and a few simple flags—price and validate—that say whether you want the system to re-price and re-validate right away.<br>
  • The response tells you:
    1. Whether the delete succeeded
    2. Any follow-up actions (like "prices updated")
    3. A structured list of info/warning/error messages
DELETE /v2/cpq/carts/{cart_Id}/promotions?id={PROMOTION_ID}

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.

Rest Handler

APIPromotionsCartsCpqV2

Rest Method

deletePromotionItems

Remote Service

CpqAppHandler

Remote Method

deleteAppliedPromoItems

Apex Remote Input Map

Map<String, Object> inputMap = new Map<String, Object>{
    'cartId' => '{CART_ID}',
    'id' => '{PROMOTION_ID}',
    'validate' => true,
    'price' => true
};
Map<String, Object> outputMap = new Map<String, Object>();
Map<String, Object> optionsMap = new Map<String, Object>();
CpqAppHandler handler = new CpqAppHandler();
handler.invokeMethod('deleteAppliedPromoItems', inputMap, outputMap, optionsMap);

Package

Communication (vlocity_cmt)

API Parameters and Response Format

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

Resource Information

Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/promotions

Example Request

DELETE
/services/apexrest/vlocity_cmt/v2/cpq/carts/801xx000003H0D1AAK/promotions?id=a35xx000000rOLhAAM&price=true&validate=true

Example Response

{
  "totalSize": 0,
  "messages": [
    {
      "code": "152",
      "severity": "INFO",
      "message": "Successfully deleted."
    }
  ],
  "actions": {
    "itempricesupdated": {
      "rest": {
        "params": {

        },
        "method": null,
        "link": null
      },
      "remote": {
        "params": {
          "cartId": "801xx000003H0JTAA0",
          "price": false,
          "methodName": "getCartLineItemPrices"
        }
      },
      "client": {
        "params": {

        }
      }
    },
    "itemdeleted": {
      "rest": {
        "params": {

        },
        "method": null,
        "link": null
      },
      "remote": {
        "params": {
          "items": [
            {
              "message": "Test_Promo has been deleted from the cart.",
              "Id": "a35xx000000rOLhAAM"
            }
          ]
        }
      },
      "client": {
        "params": {
          "items": [
            {
              "message": "Test_Promo has been deleted from the cart.",
              "Id": "a35xx000000rOLhAAM"
            }
          ]
        }
      }
    }
  }
}