All pricing constants — pizza prices, the tax rate, the delivery fee, and the coupon threshold — are declared directly insideDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/alex-pizza-assistant/llms.txt
Use this file to discover all available pages before exploring further.
app.js as JavaScript constants. Because Alex Pizza Assistant is a zero-dependency static app, app.js never reads data/menu.json at runtime; that file is reference documentation only. Every time the user submits an answer, handleSubmit() calls calculateTotals() followed by updateReceipt(), which means the receipt panel on the right side of the page stays live throughout the entire conversation, not just at the end.
Pricing Constants in app.js
The three constants that drive every calculation in the app are declared at the top ofapp.js:
data/menu.json exists in the repository as a companion reference file and its values match these constants, but app.js does not import or fetch it. All arithmetic uses the constants above.
Price Table
The three available pizza sizes and their unit prices are:| Size | Unit Price |
|---|---|
| Small | $8.99 |
| Medium | $14.99 |
| Large | $17.99 |
The delivery fee is always a flat $5.00 and is only added when
order.method === "delivery". Carry out orders pay no delivery fee regardless of order size.Total Formula
The grand total is computed in four additive layers.calculateTotals()
The function that implements the formula above iscalculateTotals() in app.js. It uses Array.reduce to iterate over every pizza in order.pizzas[] and sum up the line totals.
order.tip defaults to 0 and is only set during the tip step, so the Number(order.tip || 0) guard ensures carry out and cash delivery orders never accidentally add an undefined tip value to the total.
Receipt Panel
The live receipt panel is kept in sync byupdateReceipt(), which is called after every valid answer — not just at checkout. This means the customer can watch their subtotal, tax, and fee values update in real time as they add pizzas.
updateReceipt() are:
| Element ID | Field |
|---|---|
#rName | Customer name |
#rMethod | Carry out or delivery |
#rPayment | Payment method (or “card ending in XXXX”) |
#rSubtotal | Pizza subtotal |
#rTax | 10% sales tax |
#rDeliveryFee | Flat delivery fee |
#rTip | Driver tip |
#rTotal | Grand total |
#rItems | Itemized pizza list rendered by getPizzaSummary() |
Coupon Threshold
At the end of a completed order,finishOrder() checks whether the grand total reaches the hardcoded $50 coupon threshold.
order.total is at or above $50 receive a congratulatory bubble awarding a $10 off coupon for their next order. Orders below $50 receive a reminder bubble noting the threshold, encouraging a larger order in the future. In both cases the message appears after the order total result bubble and before the ETA countdown begins.