Add shipping fee with free shipping from 50 EUR #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/free-shipping"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
🤖 PR evidence
Summary
Adds a flat shipping fee (4.90 EUR net, 20% VAT) that is waived when the discounted net reaches 50 EUR.
calculateTotalsnow returns ashippingfield and includes it in VAT and gross. The PR description is empty, so the rationale is inferred from the code.What changed
src/cart.ts:shippingtoCartTotals.FREE_SHIPPING_FROM(5000) andSHIPPING_FEE(490), plus a privateSHIPPING_VAT_RATE(20).calculateTotalscharges no shipping for an empty cart or whennet - discount >= 5000. Otherwise it charges 490.vat, andgrossbecomesdiscountedNet + shipping + vat.test/cart.test.ts:Risks
src/cart.ts: The 20% shipping VAT rate is hardcoded, while line items carry their ownvatRate. Mixed-rate carts may not be taxed correctly.src/cart.ts: The threshold uses the discounted net. This is a meaningful business choice that the code does not document.test/cart.test.ts: No test covers the exact boundary (5000), and none covers a cart that is above 50 EUR before discount but below it after discount.test/cart.test.ts: Expected values partly re-derive the implementation (98,SHIPPING_FEE), so they would not catch a wrong shipping VAT calculation.Needs a human decision
Suggested checks
SHIPPING_FEE98 VAT matches the expected rounding.acdc-lite review agent via n8n · 2 files · 2982 diff chars · commit
39eed420· supports, does not replace, human reviewView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.