Skip to main content

Promotion Flow

Flow Overview

Process Description

  1. Initial Promo Visit

    • Customer visits with promo code in URL
    • CheckForPromo middleware intercepts request
    • PromotionService validates and records visit statistics
    • Tracks user agent and host information (up to 50 entries)
  2. Cart Addition with Promo

    • Customer adds product to cart with promo code
    • CreateCartAction validates promo code against product
    • PromotionService verifies eligibility:
      • Checks if promotion applies to product
      • Validates promotion duration
    • Records 'added to cart' statistics
  3. Order Processing

    • Order created with promotion details
      • CartHelper's syncProductsWithOrder:
      • Processes unique promotion codes
      • Increments order statistics per promotion
    • Upon successful payment:
      • OrderObserver triggers promotion updates
      • Updates promotion sales statistics
      • Records completed order count

Statistics Tracking

  1. Visit Tracking

    • Records each unique promo code visit
    • Captures basic visitor information
    • Maintains daily visit counts
  2. Cart Statistics

    • Tracks products added to cart with promo
    • Maintains conversion funnel data
  3. Sales Analytics

    • Monitors amount of orders created with promo
    • Monitors successful orders using promo
    • Tracks total sales amount per promotion
    • Records completed vs attempted orders

Key Models

  • Promotion: Manages promotion campaigns with:

    • Unique promo codes
    • Duration settings
    • Product associations
    • Platform specific settings
  • PromotionStatistic: Tracks daily metrics:

    • Visit counts
    • Cart additions
    • Sales figures
    • Orders count
    • Order completions
    • Visitor metadata