Pricing Margin Alerts
When an ingredient cost change pushes any product below your target margin, BakeOnyx alerts you on the dashboard and via email — Growth+ only.
What It Does
Bakers miss margin erosion because costs creep up one ingredient at a time. This feature catches the exact moment an ingredient cost change bumps a product below your target margin — before you've baked dozens of that product at a loss.
How Margin Is Calculated
For every active product with a positive price and positive cost:
margin % = (basePrice − cost) / basePrice × 100
Products where basePrice = 0 or cost = 0 are skipped — we can't fairly judge them.
Setting Your Target
Default target is 60%. Adjust at Settings → Post-Order Growth Emails in the "Pricing margin alerts" card. Valid range: 0–100.
- Industry norm for bakeries: 60–70% gross margin
- Premium / custom work: 70–80%+ is typical
- Wholesale / commodity: 40–50% is more common
What Triggers a Check
Editing any ingredient's cost per unit via the Ingredients page fires a cascade:
- The ingredient's new cost propagates to all recipes that use it (
Recipe.costrecomputes) - Product costs that depend on those recipes recompute (
Product.cost) - A margin check runs — if any active product is now below your target, a job is enqueued
- At most one alert email per day per bakery is sent (dedup), regardless of how many ingredients you edited
Three Surfaces
1. Dashboard Banner
An amber banner at the top of your dashboard shows the count: "X products below your Y% margin target". Click through to your products page. Dismiss the banner for the current session; it reappears if the count changes.
2. Weekly Digest Section
The Monday digest includes your top 3 below-margin products with current margin percentage. Only appears if any are below target.
3. Email to You
Sent after ingredient cost changes that pushed products below target. Lists the top 10 offenders with price and margin. Includes a "Review products" CTA to the dashboard.
Turn Off the Email, Keep the Banner
The email toggle is independent from the surface visibility. Turn "Email me when products drop below target" off and you'll still see the dashboard banner and digest section — just without the extra email.
Preview Before Going Live
Click the Preview button in settings to email yourself a rendered sample of the alert. Uses real below-target products when any exist, or 3 synthetic samples otherwise. Subject is prefixed [Preview].
What's Not a Trigger
Purchase order receiving does not currently update Ingredient.costPerUnit. If you receive an ingredient at a different price than your last-set cost, you'll need to update the ingredient manually for the margin alert to fire. This is intentional — auto-updating costs from PO receiving is a bigger project (the received price might be a one-off promo, not your new steady-state cost).
Debugging Why an Alert Didn't Fire
Ask yourself in order:
- Is your bakery on Growth tier or higher?
- Did you save the ingredient cost change successfully?
- Is the affected product active (
isActive = true)? - Do the product and recipe have a non-zero cost? (Costs of 0 are excluded.)
- Was the actual margin below your target? (If target is 60% and the new margin is 61%, no alert.)
- Have you already received an alert today? (Dedup is per UTC day.)