> ## Documentation Index
> Fetch the complete documentation index at: https://opencals.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Discounts

> Automatic and promo-code discounts — target by product, staff, location, and schedule, with stacking and usage caps. Storefront SDK v0.3.2.

<Update label="June 21, 2026" tags={["New feature", "SDK v0.3.2"]}>
  ## Discounts — new feature

  Storefronts can now apply **automatic discounts** and **promo codes** to a cart
  before checkout. Automatic discounts apply to every qualifying booking without
  customer action; code discounts require the customer to enter a promo code.

  **What's in the release:**

  * `POST /storefront/cart/discount-code` — apply a promo code to the cart
  * `DELETE /storefront/cart/discount-code` — remove the applied code
  * Every cart-returning endpoint now includes an `appliedDiscounts[]` field and
    per-line-item `discounts[]`, so you can render a "you saved \$X" summary
  * Order line items carry `OrderLineItemDiscount` records for accurate receipts
    and refunds

  **Key behaviors:**

  * Two methods: **automatic** (applies silently) and **code** (customer enters a
    promo code).
  * Two value formats: **percentage** or **fixed amount**.
  * Two scopes: **line-item** (distributed across qualifying lines) and **order**
    (applied to the cart total).
  * Targeting by **product**, **staff member**, **location**, and an
    **include add-ons** toggle. Discounts re-evaluate on every cart mutation.
  * **Scheduling**: always-active, weekly-recurring windows, or fixed date
    ranges — evaluated in the store's timezone.
  * **Requirements**: minimum purchase amount and/or appointment duration range.
  * **Stacking**: combinable discounts stack; exclusive discounts apply the single
    best deal for the customer.
  * **Usage caps**: total redemption cap and per-customer cap. Usage is tracked
    per store on multi-store and Shopify setups.

  **SDK support** — available in `@opencals/storefront-sdk`
  [v0.3.2](/docs/changelog/storefront-sdk) and higher:

  ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
  import { CartService } from "@opencals/storefront-sdk";

  // Apply a promo code
  const { data: cart } = await CartService.applyDiscountCode({
    body: { code: "WELCOME10" },
  });
  // cart.appliedDiscounts now reflects the discount

  // Remove it
  await CartService.removeDiscountCode();
  ```

  ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
  # Apply a promo code over HTTP
  curl -X POST -H "X-Api-Key: sfk_your_key" \
    -H "X-Cart-Id: {cartId}" \
    -H "Content-Type: application/json" \
    -d '{"code": "WELCOME10"}' \
    https://api.opencals.com/storefront/cart/discount-code
  ```

  See the [Discounts feature page](https://opencals.com/features/discounts) for
  the full overview, and the
  [Build a booking page guide](/docs/guides/build-a-booking-page) for where promo codes
  fit in the checkout flow.
</Update>
