Livestream E-commerce operations - landed-price and coupon-stacking calculator, single file - every coupon looks fine on its own; the classic operations failure is the stack nobody priced. Enumerate the worst-case combination, alarm on cost-floor and historic-low breaches, and never auto-delete a coupon
You are a coding agent building an internal tool for a livestream
selling team. Build a single-file HTML tool (HTML, CSS, JS all
inlined, no external dependencies, no network requests, opens by
double-click) that lets e-commerce operations compute the stacked
landed price before a link goes live. Core stance: compute the
worst case - the classic failure is not a misconfigured coupon but
a stack nobody ever priced, assembled from coupons that each
looked reasonable alone.
Input areas (manual entry, save and export):
A. Product info: name / show price / list price / per-unit direct
cost - the cost basis is fixed as "goods + platform commission
+ shipping + attached-gift offset," venue and payroll excluded
(the basis is printed on the page so the user can see the math)
B. Discount layers (add as many as needed): type (store coupon /
platform coupon / fan coupon / spend-threshold / rebate / gift
offset) / threshold / face value / scope (whole show or named
products)
C. Stacking rules: a few common platform templates plus a custom
mode (which layers are mutually exclusive, which apply in what
order, subtracted or multiplied) - the user picks the rule; the
tool never assumes how a platform behaves
D. Price reference: the product's historic-low transaction price
(manual, may be blank)
Output areas:
1. Stacking matrix: every legal combination's landed price for
the product - combination path / landed price / discount depth
versus show price, sorted lowest first, bottom row bolded
2. Two-line verdict:
- Red: minimum landed price < per-unit direct cost -> a
full-screen red banner, "below cost floor, gap X per unit,"
naming exactly which layers stacked into it
- Yellow: minimum landed price < historic-low price -> yellow
notice, "X below historic low"; with the field blank this
line stays silent
3. Volume pressure view: the user enters an estimated order
count; under red or yellow status the tool shows the total gap
- not a forecast, a unit translation of "lose X per order"
into "lose X across the show," with the arithmetic shown
on the page
Usage boundary (printed in the tool footer):
- Data stays in the local browser; nothing uploads
- On breach, alarm only - no "delete coupon" or "change price"
buttons; the mechanism is a human decision, and the tool's job
is to make the number visible before that decision
- Every step of every combination's arithmetic expands on demand
- no black-box "smart" single number
Prohibitions:
- No "apply estimated redemption rates" feature - worst-case
stacking is the hard rule; any "probably nobody stacks this"
discounting is a ramp built under the cost floor
- Cost basis and red/yellow parameters stay blank for the user
to fill - no pre-filled "typical industry cost rates"; pre-
fills get treated as authoritative defaults
- No on-screen copy like "users are unlikely to combine these"
- No accounts or cloud sync - this is a local abacus that lives
on an office machine
Why it is written this way
"Every coupon looked fine" is precisely the danger: the store coupon checks out, the platform coupon checks out, the fan coupon checks out - and the landed price of all three stacked together has been seen by no one. Real pricing incidents at big sale events almost always take this shape: each layer passes review individually, nobody prices the combination, and once orders flow in, every single one bleeds below cost. So the tool's core is not "calculating a price" but "full enumeration" - it lays out the stacking paths operations is too tired to enumerate, and bolds the lowest row.
"Worst-case stacking" is welded shut because every pricing accident shares one psychological prologue: redemption on this coupon is probably low, nobody will probably hit that threshold. Give the tool a gentle mode that applies redemption estimates, and operations will use it to tuck a blanket over the red line. Worst-case may be conservative, but it errs in the honest direction - in the real world someone always finds that floor price, and posts the recipe on social media to teach everyone else.
Red-line alarms without deletion locks out silent correction. If the tool auto-fixed the mechanism, the breach stops existing as an event - the operator never learns they designed a money-losing stack, and designs the same one next month. Leaving the gap and its stacking path glaring on the screen, waiting for a human decision, keeps the tool on the correct side of the line between "making things visible" and "deciding for someone."
The cost basis is pinned to direct cost precisely so the red line stays explainable. "Once you count rent and support, this price actually profits" is always available and always useless - the direct-cost floor is the line where selling more accelerates the bleeding, and it deserves a red that never gets diluted.
Variables
| Variable | Description |
|---|---|
| Per-unit direct cost | Goods + commission + shipping + gift offset - the red-line basis; the definition is fixed, the number is entered per product |
| Historic-low price | The lowest price this product actually cleared - the yellow-line basis; blank means the line honestly stays off |
| Stacking template | The platform's stacking order and mutual exclusions - a wrong template voids the whole matrix; prefer custom mode over a guessed template |