DiscountDefinition
interface DiscountDefinition {
code: string;
type: 'percentage' | 'fixed';
value: number;
scope: 'order' | 'package';
packageIds?: number[];
minOrderValue?: number;
maxDiscount?: number;
description?: string;
usageLimit?: number;
combinable?: boolean;
}Source: global.ts:1779
The rules that define a discount code — its type, value, what it applies to, and any limits. These are configured up front; when a shopper enters a code that matches one, it becomes an AppliedCoupon.
Properties
code: string
The code a shopper enters (e.g. "SAVE10").
type: 'percentage' | 'fixed'
Whether value is a percentage or a fixed amount.
value: number
The discount amount — a percent (e.g. 10) or a currency amount.
scope: 'order' | 'package'
Whether the discount applies to the whole order or specific packages.
packageIds: number[]
Packages the discount applies to, when scope is 'package'.
minOrderValue: number
Minimum order value required for the code to apply.
maxDiscount: number
Cap on the discount amount, for percentage discounts.
description: string
Human-readable description of the discount.
usageLimit: number
Maximum number of times the code may be used.
combinable: boolean
Whether this code can be combined with other coupons.