Bulk Add Custom Discounts to Cart
POST/v2/carts/:cartID/custom-discounts
The default value for custom discounts on both the cart and cart items is set to 5 if this parameter is not configured in the store. To verify the custom discount limit value, call Get all settings endpoint.
To increase the custom discount value, contact Elastic Path Support team.
Request
Path Parameters
Specifies the system generated ID for the cart that the shopper created.
- application/json
Body
- Array [
- ]
data object[]
Specifies an amount to be applied for the custom discount. It must be less than zero.
Specifies a description for the custom discount.
Specifies the discount code used for the custom discount.
Specifies from where the custom discount is applied. For example, Talon.one.
Specifies an external id for the custom discount.
Specifies the type of the resource. Always custom_discount
.
relationships object
item object
data object
Specifies the type of item. For example, custom_item
or cart_item
.
Specifies the unique identifier of the cart_item
or custom_item
in the cart.
options object
When true
, if an error occurs for any item, no items are added to the cart. When false
, valid items are added to the cart and the items with errors are reported in the response. Default is false
.
Responses
- 200
- 401
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
- Array [
- ]
data object[]
amount object
Specifies an amount to be applied for the custom discount. It must be less than zero.
The currency set for the custom discount.
The formatted value for the custom discount.
Specifies a description for the custom discount.
Specifies the discount code used for the custom discount.
Specifies from where the custom discount is applied. For example, Talon.one.
Specifies an external id for the custom discount.
Specifies the type of the resource. Always custom_discount
.
Specifies the UUID of the custom discount.
relationships object
item object
data object
Specifies the type of item. For example, custom_item
or cart_item
.
Specifies the unique identifier of the cart_item
or custom_item
in the cart.
options object
When true
, if an error occurs for any item, no items are added to the cart. When false
, valid items are added to the cart and the items with errors are reported in the response. Default is false
.
{
"data": [
{
"amount": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"description": "string",
"discount_code": "string",
"discount_engine": "string",
"external_id": "string",
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"relationships": {
"item": {
"data": {
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}
}
}
],
"options": {
"add_all_or_nothing": true
}
}
Unauthorized
- application/json
- Schema
- Example (from schema)
- Example
Schema
[
null
]
{
"errors": {
"status": 401,
"title": "Unauthorized"
}
}