Update an item in a cart.
Operation ID: patchCartItemBuyers with read access to carts can update items in carts. Updating items in a cart respects buyer view product entitlements, and only users entitled to view product data can access it.
curl "https://{yourinstance}.salesforce.com/services/data/v64.0/commerce/webstores/{webstoreId}/carts/{activeCartOrId}/cart-items/{cartItemId}" \
-X PATCH \
-H "content-type: application/json" \
-d '{
"quantity": 7
}'
The valid value is—cartId (ID of the cart), active (this value is only to be used for authenticated users), or current (cart that isn’t closed or pending deletion).
The ID of the cart item.
The ID of the web store.
The three-letter ISO 4217 currency code of the cart.
The ID of the buyer account or guest buyer profile for which the request is made. If unspecified, the default value is determined from context.
Specify to include complete cart data in the response. This is available ONLY when in sync mode.
{
"quantity": 7
}
The ID of the cart delivery group associated with the cart item.
An array of sObjects and custom fields for the sObjects. Standard fields are ignored. The custom fields must already be defined for the sObject. Currently, only the CartItem sObject is supported. Field-level security rules from the shopper profile are applied to the custom fields. The rules are applied for registered shoppers and for the guest shopper profile. The custom fields can be of type Checkbox, Currency, Date, Email, LongTextArea, Number, Percent, Phone, Text, TextArea, Url, Address, or Location. The customFields property isn't supported in stores built on an Aura template.
The ID of the product.
The ID of the product selling model associated with Product2. Reserved for future use.
The quantity of the cart item. Use a value that can be converted to BigDecimal.
Reserved for future use.
The type of item in a cart. This field isn't supported for the PATCH method.
Success
{
"billingFrequency": null,
"cartDeliveryGroupId": "0a7SG000001vIajYAE",
"cartId": "0a6SG000001rCgnYAE",
"cartItemId": "0a9SG000005Lm0LYAS",
"childProductCount": 0,
"currencyIsoCode": "USD",
"customFields": [],
"firstPymtTotalAmount": null,
"firstPymtTotalListPrice": 49.98,
"firstPymtTotalPrice": 41,
"firstPymtTotalTax": null,
"itemizedAdjustmentAmount": 0,
"listPrice": 24.99,
"messagesSummary": {
"errorCount": null,
"hasErrors": null,
"limitedMessages": [],
"relatedEntityId": null,
"totalLineItemsWithErrors": null
},
"name": "Alpine Energy Drink Chai Post 0.5L PET - 6 pack",
"parentCartItemId": null,
"productClass": "Simple",
"productDetails": {
"fields": {},
"name": "Alpine Energy Drink Chai Post 0.5L PET - 6 pack",
"productId": "01tSG000003uisfYAA",
"productSubscriptionInformation": null,
"purchaseQuantityRule": null,
"sku": 6010009,
"thumbnailImage": {
"alternateText": null,
"contentVersionId": null,
"id": "2pmSG000005k7q3YAA",
"mediaType": "Image",
"sortOrder": 0,
"thumbnailUrl": null,
"title": "/northerntrailoutfitters.com/nto-alpine-nutrition/default/images/large/6Pack-Chai-Post-Large.jpg",
"url": "https://s3.amazonaws.com/northerntrailoutfitters.com/nto-alpine-nutrition/default/images/large/6Pack-Chai-Post-Large.jpg"
},
"variationAttributes": {}
},
"productId": "01tSG000003uisfYAA",
"productSellingModelId": null,
"quantity": 2,
"salesPrice": 20.5,
"sellingModelType": null,
"subType": null,
"subscriptionTerm": null,
"totalAdjustmentAmount": 0,
"totalAmount": null,
"totalListPrice": 49.98,
"totalPrice": 41,
"totalTax": null,
"type": "Product",
"unitAdjustedPrice": 20.5,
"unitAdjustedPriceWithItemAdj": 20.5,
"unitAdjustmentAmount": 0,
"unitItemAdjustmentAmount": 0
}
Properties inherited from sfdc.commerce.cart.connect.api.output.AbstractCartItemRepresentation.
Specifies the billing frequency.
- Annual
- Monthly
The ID of the cart delivery group.
The ID of the cart.
The ID of the item. If asynchronous cart processing is enabled, this value returns null for POST requests.
The number of child products in the cart that are associated with the item. A cart item can have child products if the productClass of the item is Bundle. For nested bundles, which include a child product that's also a bundle, childProductCount includes all child products.
An array of sObjects and viewable custom fields for the sObjects. Standard fields are ignored. Currently, only the CartItem sObject is supported. Field-level security rules from the shopper profile are applied to the custom fields. The rules are applied for registered shoppers and for the guest shopper profile.
Messages summary for the item.
The name of the item.
The ID of the item’s parent cart item. The value is empty if the item is a top-level cart item.
Product summary for a cart item.
The ID of the product for this cart item.
The ID of the product selling model associated with Product2. Reserved for future use.
The display name for the bonus product only.
The quantity of the cart item.
Indicates the Selling Model Type enum values.
- OneTime
- TermDefined
- Evergreen
The number of subscription terms. Reserved for future use.
Type of item in a cart. Value is Product. This field is required when when adding an item to a cart (POST). This fiels is not supported when updating an item in a cart (PATCH).
- DeliveryCharge
- Product
The sub type of cart item.
- Bonus
- Gift
Details of the collection of items in a cart.
null
Indicates whether to waive shipping charges (true) or not (false). When set to true, the cart item is classified as a digital good; otherwise, it is treated as a physical good.
false
Properties defined inline.
The three-letter ISO 4217 currency code of the cart.
For subscription items, the first payment amount after adjustments and taxes. For non-subscription products, the value is the same as totalAmount.
For subscription items, the total list price of the first payment. For non-subscription items, the value is the same as totalListPrice.
For subscription items, the first term price, including adjustments but excluding taxes. For non-subscription items, the total price, including adjustments but excluding taxes.
For subscription items, the tax amount on the first payment. For non-subscription products, the value is the same as totalTax.
Total itemized adjustment amount for the item, including promotions and excluding taxes.
List price for the item.
Specifies the class of product.
- Simple
- Variation
- VariationParent
- Bundle
- Set
Sales price for the item.
Total adjustment amount for the item.
Total amount for the item.
Total list price for the item.
Total price for the item including adjustments but excluding taxes.
Total tax for the item.
Unit price, including tier level discounts, for the item. This value is informational only and isn’t used in pricing calculations.
Unit price, including both tier and item level discounts, for the item. This value is informational only and isn’t used in pricing calculations.
Tier level adjustments made to the unit price for the item. This value is informational only and isn’t used in pricing calculations.
Item level adjustments made to the unit price for the item. This value is informational only and isn’t used in pricing calculations.