Bulk Add Custom Discounts to Cart
POSThttps://useast.api.elasticpath.com/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
cartID stringrequired
Specifies the system generated ID for the cart that the shopper created.
- application/json
Body
data object[]
options object
Responses
- 200
- 401
Response Headers
- application/json
- Schema
- Example (auto)
Schema
data object[]
options object
{
"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 (auto)
- Example
Schema
detailstring
statusstring
titlestring
[
null
]
{
"errors": {
"status": 401,
"title": "Unauthorized"
}
}
Authorization: http
name: bearerAuthtype: httpscheme: bearer
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://useast.api.elasticpath.com/v2/carts/:cartID/custom-discounts");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": [\n {\n \"amount\": 0,\n \"description\": \"string\",\n \"discount_code\": \"string\",\n \"discount_engine\": \"string\",\n \"external_id\": \"string\",\n \"type\": \"string\",\n \"relationships\": {\n \"item\": {\n \"data\": {\n \"type\": \"string\",\n \"id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n }\n }\n }\n }\n ],\n \"options\": {\n \"add_all_or_nothing\": true\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear