Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taxsummary is incomplete when surcharges relation is not loaded #3423

Open
martijnvdbrug opened this issue Mar 18, 2025 · 0 comments
Open

Taxsummary is incomplete when surcharges relation is not loaded #3423

martijnvdbrug opened this issue Mar 18, 2025 · 0 comments
Labels
P3: minor Non-critical, no workarounds exist type: bug 🐛 Something isn't working

Comments

@martijnvdbrug
Copy link
Collaborator

Describe the bug
The property order.taxSummary throws an error when order.lines isn't loaded. However, when you access order.taxSummary when the surcharges relation is not loaded, it will return an incomplete tax summary, where taxes of surcharges are not included, but the surcharges are included in the order totals.

To Reproduce
Steps to reproduce the behavior:

  1. Create an order with a surcharge.
  2. Find an order using const order = await orderService.findOneByCode(ctx, "some-code", ["lines"]);
  3. Print the tax Summary with console.log(JSON.stringify(order?.taxSummary, null, 2));
  4. See that the tax summary only has the taxes of order lines, not of the surcharges. This means the totals of the summary do not add up to the order total.

Looking at the code, it seems the same happens when shippingLines is missing.

Expected behavior
I would expect this to throw an error: Surcharges relation is not joined, instead of returning an incomplete tax Summary.

Environment (please complete the following information):

  • @vendure/core version: 3.1.3
  • Nodejs version 18
  • Database (mysql/postgres etc): mysql
@martijnvdbrug martijnvdbrug added type: bug 🐛 Something isn't working P3: minor Non-critical, no workarounds exist labels Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3: minor Non-critical, no workarounds exist type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant