Skip to content

Tax rate of new determined Zone is not applied to existing order line #3366

Closed
@martijnvdbrug

Description

Describe the bug
When the tax zone of an order is changed, via a custom TaxZoneStrategy, the new tax rate isn't applied to the existing order line.

To Reproduce
Steps to reproduce the behavior:

  1. Setup your current channel to use NL
  2. Create a Tax zone NL with rate 21%
  3. Create a Tax Zone LU with rate 17%
  4. Use the AddressBasedTaxZoneStrategy to determine zone based on address
  5. Add an item to cart. See in admin it will have tax rate 21%
  6. Set an address in Luxembourg on the order
  7. See in the admin that the tax rate in the order summary is still 21%

Some findings:

  • I have confirmed that this line does set the tax rate to 17%, but it's somehow not persisted.
  • The orderLine.productVariant.taxRateApplied is 17%, but the orderLine.taxLines is [{ "description": "NL standaard", "taxRate": 21 }]
  • Adding a new item, after the tax zone is changed, does set both orderLine.productVariant.taxRateApplied and orderLine.taxLines to 17%

It seems a determined

It becomes even stranger when I add a new item to cart: The order will now have both tax rates applied.

Image

I am still investigating this.

Environment (please complete the following information):

  • @vendure/core version: 3.1.1
  • Nodejs version 18
  • Database (mysql/postgres etc): MySQL

Additional context
Add any other context about the problem here.

Metadata

Assignees

No one assigned

    Labels

    P2: importantCritical issue which does not affect majority of userstype: bug 🐛Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions