Discounts

Percentage, fixed-amount and free-shipping promotion codes: the limits you can put on them, the reasons a code gets rejected, and how product scoping matches.

A discount is a code a buyer types at checkout. Throttle computes the discounted total before handing the final amount to payment — the processor never sees the code or does any of the arithmetic.

Three types

TypeValue meansExample
percentagePercent off the qualifying subtotal10 = 10% off
fixed_amountMinor units off500 = $5.00 off
free_shippingNothing: the code makes shipping free (value is 0)Free UPS Ground to the US

Buy-X-get-Y was retired. Creating one is rejected, and a legacy row that still exists fails validation loudly rather than applying a silent $0 discount while consuming a redemption.

Free-shipping codes

A free-shipping code takes the delivery price off the order. It never changes a goods line’s discount or the tax on goods. The type is fixed when you create the code; to change it, create a new code.

SettingEffect
conditions.shipping.zoneIdsThe shipping zones the code applies to (each by its stableKey in the shipping config, which survives shipping saves and publishes), matched against the ship-to address. null means all regions. An empty list is refused
conditions.shipping.targetsThe shipping options the code makes free: a native method ({ kind: 'method', methodId }, or flat_rate) or a live carrier service ({ kind: 'carrier_service', provider, carrier, serviceCode }, for example UPS Ground). null means any option. An empty list is refused
amounts[CUR].valueOptional cap on the reduction in that currency (“up to $25 off shipping”). With no cap the shipping is free in full. A code with caps is offered only in the currencies that have one
amounts[CUR].minOrderMinimum goods subtotal to qualify
customerGroupIdsLimit the code to members of these customer groups, as for any code

A cart holds at most one goods code and one free-shipping code. Applying a second code of the same kind replaces the first. The apply endpoints are the same for both kinds, and Throttle reads the code’s type to put it in the right slot.

On the cart, the order and the checkout session, shippingTotal is the shipping the buyer pays, already net of the code, and shippingDiscountTotal is what the code took off. Shipping before the code is their sum. appliedShippingDiscount says how the code stands: applied, pending_address or pending_shipping (nothing to judge yet), not_eligible with a reason of zone, shipping_option or minimum_order (the code stays on the cart and works again once the cart qualifies), or merchant_applies (your store prices shipping itself, so your checkout honours the rule).

Remove one of two codes with DELETE .../discount?kind=order or ?kind=shipping (or ?code=). With both applied and neither given, the answer is 400 discount_kind_required.

Limits you can set

FieldEffect
startsAt / endsAtValidity window. Outside it, the code is rejected
usageLimitTotal redemptions across all buyers
maxRedemptionsPerCustomerRedemptions by one customer
isActiveOff switch that keeps the record and its history
conditions.minSubtotalMinimum order total to qualify
conditions.productIdsRestrict the discount to certain items
conditions.excludedProductIdsItems the discount never applies to (wins over productIds)

usageCount increments on redemption, so a code with usageLimit: 100 stops working on the 101st attempt rather than going negative.

Why a code gets rejected

Validation returns a specific message, and it is worth surfacing the real one to the buyer rather than a generic “invalid code”:

  • The code does not exist
  • The discount is inactive
  • The type is no longer supported (a retired buy_x_get_y row)
  • The code is a free-shipping code sent where a goods code goes, or the other way round (400 discount_kind_mismatch)
  • The store does not charge shipping, so a free-shipping code has nothing to act on (422 discount_not_applicable)
  • It has not started yet
  • It has expired
  • The total usage limit is reached
  • This customer’s limit is reached
  • The order is below the minimum total

A free-shipping code that fails on region, shipping option or minimum order is not rejected: it stays on the cart with a reason, and its reduction is 0 until the cart qualifies. A failure on group, dates or usage limits removes it, as for goods codes.

“Expired” and “you need $20 more” are different problems for the buyer, and only one of them is recoverable in the moment.

Product scoping without a product catalog

Throttle stores no products, so conditions.productIds cannot refer to a catalog. It matches against whatever identifiers your line items carry — the line item id, referenceId, sku, productId, variantId, or the same keys inside line-item metadata. Matching is case-insensitive and trimmed.

This is forgiving by design, and that cuts both ways. Because it will match a SKU, a product id, or a variant id interchangeably, a scoped discount silently applies to nothing if the identifiers you listed don’t appear on any line item — the code validates, the discount computes to zero on the qualifying subtotal. When a scoped discount “doesn’t work,” compare the ids in conditions.productIds against what your cart payload actually sends.

When a product scope is set, the discount applies only to the matching lines’ subtotal, not to the whole order.

conditions.excludedProductIds works the other way round. Lines that match it never get the discount, even when productIds also lists them, and every other line still does. Use it for “20% off everything except gift cards”. It matches the same identifiers as productIds, so the same warning applies: an exclusion that names an identifier your cart never sends excludes nothing. In the dashboard, the coupon dialogs take SKUs typed in, or products picked from the Product Catalog extension. A pick adds the SKUs the product’s variants have at that moment; a variant added later is not excluded until you add it.

Codes are per environment

The uniqueness constraint on a code includes the environment, so WELCOME10 in your test environment and WELCOME10 in production are different records with separate usage counts. Creating a code in test does not create it live.

Redemption is recorded

Each successful application writes a redemption row tying the discount to the order and customer. A free-shipping code is counted only when it actually reduced the order’s shipping, so a code that sat on a cart that never qualified is not used up. That is what enforces per-customer limits, and it is also the audit trail when someone asks who used a code and when.

Last updated November 22, 2026