Commerce Webstore Cart Coupons

Get coupons associated with a cart, and apply a coupon code to a cart.

If a store is segmented into markets, this API looks at the language parameter appended to the URL to determine the shopper’s locale and returns the appropriate values.

Resource
1/commerce/webstores/webstoreId/carts/cartStateOrId/cart-coupons
Values for cartStateOrId 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
54.0
HTTP methods
GET, POST

In API version 63.0 and later, if your store has simplified cart cleanup enabled, a POST request can apply a coupon to a cart without canceling checkout.

Request parameters for GET and POST
Parameter Name Type Description Required or Optional Available Version
currencyIsoCode String Currency ISO code of the cart. Optional 57.0
effectiveAccountId 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 54.0
Request body for POST
Root XML tag
<cartCouponInput>
JSON example
1{
2  "couponCode": "COUP10",
3  "customFields": [
4    {
5      "attributes": {
6        "type": "WebCartAdjustmentBasis"
7      },
8      "Test__C": "test@salesforce.com"
9    }
10  ]
11}
Properties
Name Type Description Required or Optional Available Version
couponCode String Coupon code. Required 54.0
customFields sObject Attributes Input[] An array of sObjects and their associated custom fields. Standard fields are ignored. The custom fields must already be defined for the sObject. Currently, only the WebCart and WebCartAdjustmentBasis sObjects is supported. Field-level security rules configured by the web store admin in the shopper profileshopper profile are applied to the custom fields. The rules are applied for registered shoppers and for the guest shopper profile. Optional 63.0
Response body for GET and POST
Cart Coupon Collection