---
schema_version: "1"
id: 4304b027f5847a93253819c6f732c970c3b4c01c803fff82c8d4cd375acb7f63
title: Replace Offer in Cart Flow
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/comms_replace_offer_in_cart_flow.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.comms_replace_offer_in_cart_flow.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: b9af33ea7c79358c8bfc556a8824fb15f62c2d1ce3523166a873bc98352e76e6
description: Use this flow to replace an existing offer in a cart containing a single valid offer with a corresponding single offer based on specified inputs. The existing offer is disconnected and a new offer is added to the cart. This flow invokes CpqCartReplaceOfferInvocable (Replace Offer in Cart) invocable actions to replace offer in a cart. For example, your existing customer wants to upgrade their limited phone plan to a new plan with unlimited data, text, and talk time. As a sales rep, you want to ensure that their existing phone service isn't interrupted and that their phone number remains the same. With this flow, you can move this customer to an unlimited plan, guaranteeing ‌continuity of service and retaining the same mobile number and email address.
products:
  - Communications
  - Media
  - Energy and Utilities
release: "264"
---
# Replace Offer in Cart Flow

Use this flow to replace an existing offer in a cart containing a single valid offer with a corresponding single offer based on specified inputs. The existing offer is disconnected and a new offer is added to the cart. This flow invokes CpqCartReplaceOfferInvocable (Replace Offer in Cart) invocable actions to replace offer in a cart. For example, your existing customer wants to upgrade their limited phone plan to a new plan with unlimited data, text, and talk time. As a sales rep, you want to ensure that their existing phone service isn't interrupted and that their phone number remains the same. With this flow, you can move this customer to an unlimited plan, guaranteeing ‌continuity of service and retaining the same mobile number and email address.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody></table>

## Industries CPQ API Used to Invoke Replace Offer in Cart Flow

- getCartsTargetOffers - Identify valid offers to replace for a specified asset.
- replaceOffers - Replaces an existing offer with a new offer in the cart.

## Input Values

| Parameter | description | data type |
| --- | --- | --- |
| cartId | The ID of the quote, order, or opportunity record where the offer must be replaced. | String |
| offerId | The ID of the target product or offer to replace the current product or offer. | String |
| validate | Optional. A Boolean value that indicates whether to validate the configuration of the line item before replacing the line item. The default value is true. | Boolean |
| price | Optional. A Boolean value that indicates whether to recalculate the price based on a new offer. The default value is true. | Boolean |

## Output Values

| Parameter | description | data type |
| --- | --- | --- |
| output | A JSON string that includes the details of the replace offer action. | String |
| error | An error that was encountered during action execution. | String |

## Example

JSON Request

```json
priceBookEntryId = 01uDn000001Af70IAC
cartId = 801Dn000000vRO7IAM
```

JSON Response Body

```json
cartId = "801Dn000000vRO7IAM"
errorMessage = "null"
replacementOfferResult = "{"actions":{"itempricesupdated":{"client":{"params":{}},"remote":{"params":{"methodName":"getCartLineItemPrices","cartId":"801Dn000000vRO7IAM","price":false}},"rest":{"link":"/services/apexrest/vlocity_arvk/v2/cpq/carts/801Dn000000vRO7IAM/price?price=false","method":"GET","params":{}}}},"messages":[{"message":"Replacement applied successfully","severity":"INFO","code":"830"}],"totalSize":0}"
```