Enable Purchase Lists to Contain the Same Product in Multiple Line Items Based on Custom Property Values
As of the 24D release, Oracle Commerce introduces the capability for purchase lists to include the same product in multiple line items, differentiated by custom property values. This enhancement is available on both the Storefront and Agent interfaces. By default, this feature is disabled but can be activated upon request. The following APIs have been updated to accommodate this new functionality:
- POST /purchaseLists
- PUT /purchaseLists/{id} updatePurchaseList
- POST /purchaseLists/{id}/updateItems
With this capability, shoppers can add the same product to the purchase list with different custom properties and view them as distinct line items in the list allowing them to manage their personal preferences easily.
Steps to Enable
- To enable this feature, set enablePurchaseListItemCustomPropertiesAsKeys to true from the updateCloudConfiguration (/ccadmin/v1/merchant/cloudConfiguration) API. Please refer to the REST API documentation for Oracle Commerce for more information.
- To allow adding purchase list line items with different custom properties, merchants can configure their widgets to pass the API payload as follows:
- POST /purchaseLists createPurchaseList
{
"name":"Purchase List 1",
"description":"Purchase List",
"siteId":"siteUS",
"accountId":"or-100001",
"items": [
{
"productId":"Product_18Cxi",
"catRefId": "Sku_18Dxi",
"quantityDesired" : 25,
"customPLIProperty_1": "123"
},
{
"productId":"Product_18Cxi ",
"catRefId": "Sku_18Dxi ",
"quantityDesired" : 30,
"customPLIProperty_1": "456"
}
]
}
- PUT /purchaseLists/{id} updatePurchaseList
{
"name":"Purchase List 1",
"description":"Purchase List",
"siteId":"siteUS",
"accountId":"or-100001",
"items": [
{
"productId":"Product_18Cxi",
"catRefId": "Sku_18Dxi",
"quantityDesired" : 25,
"customPLIProperty_1": "123"
},
{
"productId":"Product_18Cxi ",
"catRefId": "Sku_18Dxi ",
"quantityDesired" : 30,
"customPLIProperty_1": "456"
}
]
}
- POST /purchaseLists/{id}/updateItems updateItems. For update and delete operations on Purchase List items using this API, the purchase list line item ID must be included in the payload.
{
"items": [
{
"op": "delete",
"productId": "Product_18Cxi",
"quantityDesired": 25,
"catRefId": "Sku_18Dxi",
"id": "gi123"
},
{
"op": "update",
"productId": "Product_5Cx",
"quantityDesired": 30,
"catRefId": "Sku_5Cxy",
"id": "gi456"
}
]
}
- No change in behaviour of listPurchaseLists, deletePurchaseList and checkEditAccess APIs.
Tips And Considerations
- This feature is API only and merchants would have to implement the UI based on their business needs.
-
Once the enablePurchaseListItemCustomPropertiesAsKeys is enabled, it is not recommended to disable it. If disabled, the updateItems API (POST: /purchaseLists/{id}/updateItems) may unpredictably modify or merge identical line items with different custom properties in existing purchase lists. This issue can be addressed in several ways:
- Avoid Disabling the Feature: The simplest solution is to ensure that the enablePurchaseListItemCustomPropertiesAsKeys feature remains enabled to prevent any unintended modifications to purchase list items.
- Review and Update Purchase Lists: If the feature has been disabled and issues arise, review and manually update affected purchase lists to ensure that line items with different custom properties are correctly maintained.
- Contact Support: If the problem persists or if manual updates are not feasible, contact customer support for assistance in resolving the issue.