Apply Adjustment

Apply an adjustment (such as a discount, markup, or override) to a price for a cart and line item, which are specified by the cartId and id parameters.

The PricingElementServiceImplementation supports this API.

Prior to the Fall '20 release, the applyAdjustment API included a call to getCartsItems. However, from the Fall '20 release, this API no longer calls getCartsItems. If you call this API directly in custom code, ensure that you add a call to getCartLineItemPrices in your code, after calling the applyAdjustment API. The response from this API has been updated to include the itempricesupdated action to make a call to the next API.

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.

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}/pricing

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

Use the table in this topic to diagnose problems that occur when executing the the API.

Error MessageDescription
A virtual price cannot be adjusted.This error message is displayed if you try to adjust a base price of a virtual product.
Cannot apply adjustment without base charge.This error message is displayed:

    Calculated prices are derived from other base prices. For example, the UnitPrice of a product is calculated based on the base price of the product and the quantity of the product.If you want to adjust base prices that haven't been initialized, you can set the CheckVariableBasePrice CPQ Custom Setting to False. This setting allows you to make adjustments to the base prices, but it can lead to unexpected results.

    |

    Adjustments can be made without a PriceListEntryID.