Skip to content

Add separate base cost and margin pricing formulas#43

Draft
durasj wants to merge 1 commit intomainfrom
cursor/-bc-629dd6f8-1f37-407e-9d87-7378916a2340-60e7
Draft

Add separate base cost and margin pricing formulas#43
durasj wants to merge 1 commit intomainfrom
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, while keeping legacy formula compatibility
  • compute and persist item-level baseCost, margin, and price during cart-item pricing hydration
  • update order-item and cart total fallbacks to use the new pricing breakdown total

Walkthrough

billboards_pricing_updates.mp4

Total after size selection
Total after configuration selection

pricing_breakdown_smoke.log

Testing

  • npm run lint (passes; 1 pre-existing unrelated warning in src/app/[locale]/page.tsx)
  • npm run build (passes)
  • npx tsx /tmp/pricing_smoke.ts (passes; validates both dual-formula and legacy formula pricing breakdown)
  • manual UI validation on /en/order/item/bb123?productId=eadb7fea-799e-4bf0-a9e2-beb98860165f confirms total updates as options are changed

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 Apr 6, 2026 7:04am

Request Review

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