Newer Version Available

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

Commerce Webstore Promotions, Execute Action

Applies associated promotion discounts to a cart and its items.
Resource
1/commerce/webstores/webstoreId/promotions/actions/execute
Available version
53.0–55.0

In version 56.0 and later, use Commerce Webstore Promotions, Evaluate Action.

Important

HTTP methods
POST
Request body for POST
Root XML tag
<salesTransaction>
JSON example (percentage discount applied to entire transaction)
1{
2   "effectiveAccountId":"001RM000004ywq7YAA",
3   "salesTransaction":{
4      "attributes":{
5         "type":"WebCart"
6      },
7      "Id":"0a6RM00000009XAYAY",
8      "CurrencyIsoCode":"USD",
9      "WebCartAdjustmentGroups":{
10         "records":[
11            {
12               "attributes":{
13                  "type":"WebCartAdjustmentGroup"
14               },
15               "AdjustmentSource":"Promotion",
16               "AdjustmentType":"AdjustmentPercentage",
17               "AdjustmentValue":-20,
18               "PriceAdjustmentCauseId":"0c8RM0000004CrMYAU",
19               "Priority":2
20            }
21         ]
22      },
23      "CartItems":{
24         "records":[
25            {
26               "attributes":{
27                  "type":"CartItem"
28               },
29               "Id":"0a9RM0000004OseYAE",
30               "Product2Id":"01tRM000000QVWKYA4",
31               "Quantity":15,
32               "SalesPrice":45.00,
33                "CartItemPriceAdjustments":{
34                  "records":[
35                     {
36                        "attributes":{
37                           "type":"CartItemPriceAdjustment"
38                        },
39                        "AdjustmentSource":"Promotion",
40                        "AdjustmentType":"AdjustmentPercentage",
41                        "AdjustmentValue":"-10.0",
42                        "PriceAdjustmentCauseId":"0c8RM00000000xUYAQ",
43                        "Priority":1
44                     }
45                  ]
46               }
47            },
48            {
49               "attributes":{
50                  "type":"CartItem"
51               },
52               "Id":"0a9RM0000004OsfYAE",
53               "Product2Id":"01tRM000000QVW7YAO",
54               "Quantity":5,
55               "SalesPrice":99.50
56            }
57         ]
58      }
59   }
60}
JSON example (specific adjustment amount applied to one item)
1{
2   "effectiveAccountId":"001RM000004ywq7YAA",
3   "salesTransaction":{
4      "attributes":{
5         "type":"WebCart"
6      },
7      "Id":"0a6RM00000009XAYAY",
8      "CurrencyIsoCode":"USD",
9      "WebCartAdjustmentGroups":{
10         "records":[
11            {
12               "attributes":{
13                  "type":"WebCartAdjustmentGroup"
14               },
15               "AdjustmentSource":"Promotion",
16               "AdjustmentType":"AdjustmentPercentage",
17               "AdjustmentValue":-20,
18               "PriceAdjustmentCauseId":"0c8RM0000004CrMYAU",
19               "Priority":2
20            }
21         ]
22      },
23      "CartItems":{
24         "records":[
25            {
26               "attributes":{
27                  "type":"CartItem"
28               },
29               "Id":"0a9RM0000004OseYAE",
30               "Product2Id":"01tRM000000QVWKYA4",
31               "Quantity":15,
32               "SalesPrice":45.00,
33                "CartItemPriceAdjustments":{
34                  "records":[
35                     {
36                        "attributes":{
37                           "type":"CartItemPriceAdjustment"
38                        },
39                        "AdjustmentSource":"Promotion",
40                        "AdjustmentType":"AdjustmentAmount",
41                        "AdjustmentAmountScope":"Unit",
42                        "AdjustmentValue":"-10.0",
43                        "PriceAdjustmentCauseId":"0c8RM00000000xUYAQ",
44                        "Priority":1
45                     }
46                  ]
47               }
48            },
49            {
50               "attributes":{
51                  "type":"CartItem"
52               },
53               "Id":"0a9RM0000004OsfYAE",
54               "Product2Id":"01tRM000000QVW7YAO",
55               "Quantity":5,
56               "SalesPrice":99.50
57            }
58         ]
59      }
60   }
61}
Properties
Name Type Description Required or Optional Available Version
effective​AccountId String ID of the account for which the request is made. Required 53.0
sales​Transaction Map<String, Object> Map of a cart, its items, and its price adjustments. The fields shown in the example are required. Additional fields are allowed but ignored.

The CartItem.SalesPrice field is used to pass the unit price after all price adjustments (tiered discounts) have been applied. The value in this field corresponds to the value of the CartItem.UnitAdjustedPrice field (which is an ignored field).

Note

In error messages, the SalesPrice field is referred to as StartingUnitPrice.

Note

Required 53.0
Response body for POST
Promotion Execution