Loading
ただいま大変多くのお問い合わせをいただいており、ご連絡までにお時間を頂戴しております続きを読む

How to Add Optional Products to Cart using postCartsItems API

公開日: Jun 24, 2026
前提条件
Cart APIs, postCartsItems API, vlocity_cmt CPQ cart endpoint, bundle product, optional child product, cartId 801Pw00000vhatsIAA, root product 01tQD00000Qk4HuYAJ, optional component product 01tPw00000P5RHJIA3, itemId 01uPw00000bVM3mIAG
タスク
How do I add an optional child product to a bundle using the postCartsItems API?
ステップ

The sample API endpoint and payload format for adding an optional product to a cart.

API Endpoint:

/services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items

Sample Payload:

{
  "methodName": "postCartsItems",
  "cartId": "<CartId>",
  "validate": true,
  "price": true,
  "hierarchy": -1,
  "items": [
    {
      "itemId": "<PricebookEntryId_of_OptionalProduct>",
      "parentId": "<LineItemId_of_ImmediateRealParent>",
      "parentHierarchyPath": "<Product2Id_of_RootParent>",
      "parentRecord": {
        "records": [
          {
            "productId": "<Product2Id_of_ParentBundle>",
            "productChildItemId": "<productChildItemDefinition_Id>",
            "productHierarchyPath": "<Product2Id_of_RootParent>",
            "action": "Add",
            "isVirtualItem": false,
            "displaySequence": -1,
            "defaultQuantity": 1,
            "minQuantity": 0,
            "maxQuantity": 99999,
            "Product2Id": "<Product2Id_of_ParentBundle>",
            "Id": {
              "value": "<LineItemId_of_ParentBundle>"
            },
            "productChildItemDefinition": {
              "Id": "<productChildItem_Id>",
              "vlocity_cmt__ParentProductId__c": "<Product2Id_of_ParentBundle>",
              "vlocity_cmt__IsRootProductChildItem__c": true,
              "vlocity_cmt__IsOptional__c": true,
              "vlocity_cmt__IsOverride__c": false,
              "vlocity_cmt__CollapseHierarchy__c": false,
              "vlocity_cmt__IsVirtualItem__c": false,
              "vlocity_cmt__Quantity__c": 1
            }
          }
        ]
      }
    }
  ]
}

You can modify the placeholder values in the payload according to your specific use case and product hierarchy requirements.

ナレッジ記事番号

005387550

 
読み込み中
Salesforce Help | Article