Skip to main content

Delete Rule Promotion Codes

DELETE 

https://useast.api.elasticpath.com/v2/rule-promotions/:promotionID/codes

Deletes one or more promotion codes from a specific rule promotion.

  • Supports bulk deletion, allowing multiple codes to be removed in a single request.
  • Removes promotion codes permanently, making them unavailable for future use.
  • If a code has already been redeemed, it will be removed from the system but may still reflect in historical transactions.

A successful request returns a 204 No Content response, indicating the specified promotion codes have been deleted.

Request

Path Parameters

    promotionID stringrequired

    The unique identifier of the rule promotion.

Header Parameters

    Authorization Bearerrequired

    The Bearer token required to get access to the API.

Bodyrequired

    data object
    typestring

    Possible values: [promotion_codes]

    codes object[]

    Specifies the code details in an array of objects.

  • Array [
  • codestring

    Specifies the string to use as a code for the promotion.

    usesinteger

    Specifies the number of times the code can be used. If no value is set, the customer can use the code any number of times.

    userstring

    Specifies the customer ID of the shopper who can use the code. For more information, see the Create a customer section.

    consume_unitstring

    Specifies whether the code is consumed per application or per checkout. With per_checkout, the code is used once for each checkout, regardless of the number of items in the cart. When set to per_application, the code is used per application. For cart discounts, each application counts as one usage. For item discounts, each application to either a single quantity or a bundle is counted as one usage. For example, in a store that offers 50% off on SKU1, SKU2, and SKU3, and limits the maximum usage of the promotion code to two, a shopper can apply the promotion up to two quantities. If the cart contains two or more quantities of SKU1, the promotion is applied 2 times to SKU1, and other quantities and items are at the regular price. If the cart contains one quantity of SKU1, one quantity of SKU2, and one quantity of SKU3, the promotion is applied once to SKU1 and once to SKU2. The code usage is applied at checkout and the code is considered consumed at that point.

    Possible values: [per_application, per_checkout]

    max_users_per_shopper object

    Object for setting max uses per shopper. Only include this object, when you want to set limit per shopper.

    max_usesinteger

    Sets max number of times the code can be used by a shopper. NOTE - This cannot be set with per_application consume unit.

    includes_guestsboolean

    The flag to include guest shoppers for the discount with max use restriction. If this field is provided, the max_uses value is required. When set to true, guest shoppers must have an email associated with the cart to use the code. A guest cart without an email cannot use the code. When set to false, guest shoppers cannot use the promo code, even if the cart has an associated guest email.

    Default value: false
    is_for_new_shopperboolean

    A flag indicating whether the coupon is for first-time shoppers. If set to true, the discount will only apply if the shopper has never made a payment on any order in the store. If set to false or left unset, it will be a regular discount that applies to all shoppers. When this flag is set to true, the coupon cannot have usage limitations or be assigned to specific users.

  • ]

Responses

No Content

Authorization: http

name: BearerAuthtype: httpscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Delete, "https://useast.api.elasticpath.com/v2/rule-promotions/:promotionID/codes");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"promotion_codes\",\n \"codes\": [\n {\n \"code\": \"string\",\n \"uses\": 0,\n \"user\": \"string\",\n \"consume_unit\": \"per_application\",\n \"max_users_per_shopper\": {\n \"max_uses\": 0,\n \"includes_guests\": false\n },\n \"is_for_new_shopper\": true\n }\n ]\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://useast.api.elasticpath.com
Auth
Parameters
— pathrequired
— headerrequired
Body required
{
  "data": {
    "type": "promotion_codes",
    "codes": [
      {
        "code": "string",
        "uses": 0,
        "user": "string",
        "consume_unit": "per_application",
        "max_users_per_shopper": {
          "max_uses": 0,
          "includes_guests": false
        },
        "is_for_new_shopper": true
      }
    ]
  }
}
ResponseClear

Click the Send API Request button above and see the response here!

We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.