Esti aici: Portofoliu / studii de caz » Advanced Promotion Engine with Pre-Order Validation Logic

Advanced Promotion Engine with Pre-Order Validation Logic

For a complex B2B e-commerce platform I developed a fully custom promotion system that supports multiple types of dynamic discounts and gift-based offers (e.g., “Buy N, get X free”, “Minimum cart value – receive a gift”, “Buy one, get % off second item” etc.).

A key architectural challenge was the decoupling of cart submission and order approval. In this system, users often place pre-orders that are subject to later approval (by managers, departments, or other user roles).

Promotions are not frozen at the moment of cart submission. Between the time a pre-order is saved and the moment it is approved, the commercial context may change — products can be removed, discounts updated, or new promotions may appear.

To ensure consistency and fairness:

  • Each pre-order saves a snapshot of applicable promotions and resulting effects (e.g., gifts received, prices after discount).

  • Upon approval, a validation engine checks for any discrepancies:

    • Price increases → require review.

    • Gifts or discounts no longer available → require review.

    • New promotions that apply but weren’t present before → ignored unless they affect user-selected items.

For cross-product promotions (e.g., “Buy A, get % off B”), the system uses a greedy pairing algorithm that dynamically distributes discounts to maximize customer value, while retaining full traceability.

The design balances flexibility for the admin (who can add/change/remove promotions at any time) with predictability for the user, who is always notified if their pre-order needs to be reviewed.

✦ The logic supports dozens of concurrent promotions, handles edge cases like overlapping rules, and ensures that no promotion ever applies silently to the user's disadvantage.

 

    Acest site foloseste cookies pentru a personaliza conținutul, pentru analiza traficului și statistică; unele informații de utilizare a site-ului sunt procesate de partenerii noștri. Puteți oricând să ștergeți cookie-urile din browser. Citeste aici politica de cookies, politica de confidentialitate si termenii si conditiile de utilizare.
    Am citit, am inteles si sunt de acord.