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
Responses
- 200
- 401
Response Headers
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