pub struct Promotion {Show 37 fields
pub id: PromotionId,
pub code: String,
pub name: String,
pub description: Option<String>,
pub internal_notes: Option<String>,
pub promotion_type: PromotionType,
pub trigger: PromotionTrigger,
pub target: PromotionTarget,
pub stacking: StackingBehavior,
pub status: PromotionStatus,
pub percentage_off: Option<Decimal>,
pub fixed_amount_off: Option<Decimal>,
pub max_discount_amount: Option<Decimal>,
pub buy_quantity: Option<i32>,
pub get_quantity: Option<i32>,
pub get_discount_percent: Option<Decimal>,
pub tiers: Option<Vec<DiscountTier>>,
pub bundle_product_ids: Option<Vec<ProductId>>,
pub bundle_discount: Option<Decimal>,
pub starts_at: DateTime<Utc>,
pub ends_at: Option<DateTime<Utc>>,
pub total_usage_limit: Option<i32>,
pub per_customer_limit: Option<i32>,
pub usage_count: i32,
pub conditions: Vec<PromotionCondition>,
pub applicable_product_ids: Vec<ProductId>,
pub applicable_category_ids: Vec<Uuid>,
pub applicable_skus: Vec<String>,
pub excluded_product_ids: Vec<ProductId>,
pub excluded_category_ids: Vec<Uuid>,
pub eligible_customer_ids: Vec<CustomerId>,
pub eligible_customer_groups: Vec<String>,
pub currency: CurrencyCode,
pub priority: i32,
pub metadata: Option<Value>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
A promotion/discount offer
Fields§
§id: PromotionId§code: StringUnique code for the promotion (for internal reference)
name: StringDisplay name
description: Option<String>Description for customers
internal_notes: Option<String>Internal notes
promotion_type: PromotionType§trigger: PromotionTrigger§target: PromotionTarget§stacking: StackingBehavior§status: PromotionStatus§percentage_off: Option<Decimal>Percentage off (0.0-1.0, e.g., 0.20 for 20%)
fixed_amount_off: Option<Decimal>Fixed amount off
max_discount_amount: Option<Decimal>Maximum discount amount (cap)
buy_quantity: Option<i32>Quantity to buy
get_quantity: Option<i32>Quantity to get free/discounted
get_discount_percent: Option<Decimal>Discount on the “get” items (1.0 = free, 0.5 = 50% off)
tiers: Option<Vec<DiscountTier>>Tiered discount rules (JSON array of tiers)
bundle_product_ids: Option<Vec<ProductId>>Required product IDs for bundle
bundle_discount: Option<Decimal>Bundle discount when all products purchased
starts_at: DateTime<Utc>§ends_at: Option<DateTime<Utc>>§total_usage_limit: Option<i32>Total uses allowed (None = unlimited)
per_customer_limit: Option<i32>Uses per customer (None = unlimited)
usage_count: i32Current usage count
conditions: Vec<PromotionCondition>§applicable_product_ids: Vec<ProductId>Specific product IDs this applies to (empty = all)
applicable_category_ids: Vec<Uuid>Specific category IDs this applies to (empty = all)
applicable_skus: Vec<String>Specific SKUs this applies to (empty = all)
excluded_product_ids: Vec<ProductId>Excluded product IDs
excluded_category_ids: Vec<Uuid>Excluded category IDs
eligible_customer_ids: Vec<CustomerId>Specific customer IDs (empty = all customers)
eligible_customer_groups: Vec<String>Customer groups/segments
currency: CurrencyCode§priority: i32§metadata: Option<Value>§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl Promotion
impl Promotion
Sourcepub fn has_product_scoping(&self) -> bool
pub fn has_product_scoping(&self) -> bool
Whether this promotion restricts which products it applies to (any applicability or exclusion list is non-empty).
Sourcepub fn item_in_scope(&self, item: &PromotionLineItem) -> bool
pub fn item_in_scope(&self, item: &PromotionLineItem) -> bool
Whether a line item is in scope for this promotion’s product lists.
Exclusions win over applicability. When any applicability list is set, the item must match at least one of them; otherwise every non-excluded item is in scope.
Sourcepub fn discount_description(&self) -> String
pub fn discount_description(&self) -> String
Get human-readable discount description