Newer Version Available

This content describes an older version of this product. View Latest

Commerce Webstore Cart, Calculate

Perform a complete cart calculation based on the cart status. Possible calculations include computing prices, evaluating promotions, checking the inventory, computing shipping costs, evaluating shipping promotions, applying post shipping adjustments, and computing taxes.
Resource
1/commerce/webstores/webstoreId/carts/activeCartOrId/actions/calculate
Values for activeCartOrId are:
  • cartId—ID of the cart.
  • active—Active cart. This value should only be used for authenticated users.
  • current—Cart that isn’t closed or pending deletion. Available in version 50.0 and later.
Available version
62.0
HTTP methods
POST
Request body for POST
Root XML tag
cartCalculateInput
JSON example
1{
2  "customFields": [
3     {
4       "attributes": {
5         "type": "WebCart"
6       },
7       "WebCartCustomField1__c": "Foo"
8     },
9     {
10       "attributes": {
11         "type": "CartItem"
12       },
13       "id": "0a9xx0000000002CI1",
14       "CartItemCustomField1__c": "CI1_Field1Value",
15       "CartItemCustomField2__c": "CI1_Field2Value"
16     },
17     {
18       "attributes": {
19         "type": "CartItem"
20       },
21       "id": "0a9xx0000000002CI2",
22       "CartItemCustomField1__c": "CI2_Field1Value",
23       "CartItemCustomField2__c": "CI2_Field2Value"
24     },
25     {
26       "attributes": {
27         "type": "CartDeliveryGroup"
28       },
29       "id": "0a7xx000000000CDG1",
30       "CartDeliveryGroupCustomField1__c": "CDG1_Field1Value",
31       "CartDeliveryGroupCustomField2__c": "CDG1_Field2Value"
32     }
33   ]
34}
Properties
Name Type Description Required or Optional Available Version
customFields sObject Attributes Input[] Array of sObjects and custom fields for the sObjects. Standard fields are ignored. The custom fields must already be defined for the sObject. Currently, the WebCart, CartItem, and CartDeliveryGroup sObjects are 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. See Create a Cart and Cart Item with Custom Fields in a Commerce Store. Optional 63.0
Request parameters for POST
Parameter Name Type Description Required or Optional Available Version
effective​AccountId String ID of the buyer account or guest buyer profile for which the request is made. If unspecified, the default value is determined from context. Optional 62.0
Response body for POST
Cart Summary Result