# Create a discount campaign Create a test promotion that subtracts EUR 10.00 from eligible carts with at least EUR 100.00 subtotal. This is a cart promotion, so the eligibility condition uses cart context. ## Before you begin Use Admin discount permissions and a test store with EUR prices. Choose a test campaign window and replace both timestamp placeholders below with UTC ISO 8601 values. Use a short test window and avoid overlapping production campaigns. Read [Cart discounts and targets](/concepts/discounts/cart-discounts) for the eligibility-versus-target distinction. ## 1. Create the code resource Admin API ```graphql mutation CreateCampaignCode($input: CartDiscountCodeCreateInput!) { cartDiscountCodeCreate(input: $input) { cartDiscountCode { id codes { value } } errors { __typename ... on UserError { message } } } } ``` Variables ```json { "input": { "name": "Lamp campaign test", "codes": [ "LAMP10TEST" ], "maxApplications": 10, "validFrom": "", "validUntil": "" } } ``` Retain the code resource ID. Creating the code does not create the discount or attach the code to it. ## 2. Create and connect the discount Admin API ```graphql mutation CreateLampCampaign($input: CartDiscountCreateInput!) { cartDiscountCreate(input: $input) { cartDiscount { id name predicate priority } errors { __typename ... on UserError { message } } } } ``` Variables ```json { "input": { "name": "EUR 10 off EUR 100", "predicate": "currency_code == \"EUR\" && subtotal.cent_amount >= 10000", "priority": 100, "targetType": "TOTAL", "absoluteValue": { "amounts": [ { "centAmount": 1000, "currencyCode": "EUR" } ] }, "requiresDiscountCode": true, "discountCodes": [ "" ], "validFrom": "", "validUntil": "" } } ``` Replace the code-resource placeholder with the ID from step 1. The value is absolute money, so this example avoids ambiguity between percent and factor units. The priority is an example; review existing campaigns and their combination rules before choosing it. ## 3. Apply in a test cart Storefront API ```graphql mutation ApplyCampaign($input: CartDiscountCodeAddInput!) { cartDiscountCodeAdd(input: $input) { cart { id total { centAmount currencyCode } } errors { __typename ... on UserError { message } } } } ``` Variables ```json { "input": { "cartId": "", "discountCode": "LAMP10TEST" } } ``` Inspect the cart's discount applications and returned totals through the [Cart reference](/api/storefront-graphql/objects/cart). Do not infer a saving solely from the code string being present. Tax and other configured discounts can affect the final payable amount. ## 4. Verify both sides of the rule Test EUR carts just below and at the threshold, a cart in another currency, a missing code, an expired window, and any intended overlapping offer. Confirm only the qualifying case gets this promotion's application. Use [Codes and combination](/concepts/discounts/codes-and-combination) to diagnose a configured code with no saving. ## End the test Update the intended validity window or remove the test configuration using supported Admin operations. Do not delete unrelated campaign codes. Re-query a fresh cart and confirm the offer no longer applies. Existing orders keep their recorded commercial outcome.