Back to prompts
Code06.11.2026
Validate Black Friday Discount Codes and Cart Rules With a Fixture Script
#black friday#discount codes#cart rules#ecommerce#testing#node#python#qa
You are a careful ecommerce engineer who helps small shops catch promo bugs before Black Friday traffic hits. I want a small script that validates my discount codes and cart rules against a fixture cart before the sale goes live. Prefer a single file I can run locally. Do not invent my stack, promo engine, or storefront. Do not invent CLI flags or library APIs that may not exist; use well known approaches and tell me to confirm current options. If something is unclear, list it under [QUESTIONS] before the code. Preferred language (Node.js or Python; pick one if I leave this blank and say which you chose): [STACK] How I store promo rules today (JSON file, spreadsheet export, admin screenshots, paste of rules): [RULES SOURCE] Sample discount codes and what each should do (percent off, fixed amount, free shipping, BOGO, stackable or not, min cart, excluded SKUs): [CODES] A fixture cart as a list of line items with sku, name, unit price, quantity, and any tags like sale or excluded: [CART] Currency and tax handling I care about (ignore tax, tax after discount, shipping separate): [MONEY RULES] Where the script should print results (terminal table, JSON file, both): [OUTPUT] Requirements: 1. Restate my rules in plain English and flag any conflicts (two codes both marked exclusive, a code that needs a min cart higher than my fixture, a BOGO with no clear eligible SKU). 2. Design a fixture format (JSON or simple Python/JS object) for cart lines and for each discount code. Keep it small and readable. 3. Write the validation script for [STACK]. For each code, apply it to the fixture cart according to the stated rules and report: eligible or not, discount amount, cart total after discount, and any reason it was rejected. 4. Include at least 3 automated assertions I can run as a tiny test: one code that should apply, one that should fail the min cart, and one that should refuse an excluded SKU. Use the language's built in assert or a minimal test runner; do not invent a heavy framework. 5. Handle edge cases honestly: empty cart, zero price items, quantity limits, rounding to 2 decimal places, and codes that claim to stack when my rules say they do not. 6. Add a short README section: how to install any dependency, how to edit the fixture, and how to run the script. Tell me to confirm library versions before I ship this into CI. 7. List [QUESTIONS] for anything I left blank that would change the math (tax inclusive prices, shipping discounts, gift cards). Honest limits: this is a pre-sale fixture check, not a full checkout integration test. It will not replace testing the live cart on staging. Deliverables: 1. Plain English rule restatement and conflict flags 2. Fixture format 3. Validation script 4. 3 assertions 5. README run steps 6. [QUESTIONS] list
How to use this prompt
- 1Copy the prompt using the button above.
- 2Open your AI tool (ChatGPT, Claude, Midjourney, etc.)
- 3Paste and customize any variables in the prompt.
- 4Generate your result.
Tip
Fill every placeholder before you run the prompt. Keep one clear goal per run, then refine with a follow-up if needed.
When to use this prompt
- •Good for first drafts in Code
- •Keep variables filled so the model has enough context
- •Review AI output before sending or publishing