Skip to content

Add separate base cost and margin pricing formulas#43

Draft
durasj wants to merge 2 commits into
mainfrom
cursor/-bc-629dd6f8-1f37-407e-9d87-7378916a2340-60e7
Draft

Add separate base cost and margin pricing formulas#43
durasj wants to merge 2 commits into
mainfrom
cursor/-bc-629dd6f8-1f37-407e-9d87-7378916a2340-60e7

Conversation

@durasj
Copy link
Copy Markdown
Member

@durasj durasj commented Apr 6, 2026

Summary

  • add support for separate baseCostFormula and marginFormula on product pricing
  • persist item-level baseCost, margin, and price during cart-item pricing hydration
  • remove backward-compatibility for the legacy total formula field from schema and runtime pricing
  • keep cart/order totals sourced from the new pricing breakdown total

Testing

  • npm run lint (passes; 1 pre-existing unrelated warning in src/app/[locale]/page.tsx)
  • npm run build (passes)
  • npx tsx /tmp/pricing_formula_drop_smoke.ts (passes; validates that dual formulas compute values and legacy-only formula now produces zero pricing)

pricing_formula_drop_smoke.log

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Co-authored-by: Jakub Duras <jakub@duras.me>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 6, 2026 11:39am

Request Review

Co-authored-by: Jakub Duras <jakub@duras.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants