-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Price with tax incorrect while using BigInt strategy #2527
Comments
Hi, I am not able to reproduce this so far. Can you clarify what you mean by this step?
|
Hi @michaelbromley, @daniel-lxs indicates is that you add or adjust the value on the tax page. In Colombia the tax is 19%. So the second step was to adjust that value: Once the tax has been adjusted. When checking the product and its variants, this price with tax appears in the admin-ui: This product costs $40,000 COP, expressed in cents is 4000000 and the tax of this product, expressed in cents, is 760000. What we assume is that Vendure in GraphQL is concatenating these values 4000000 + 760000 = 4000000760000 On the other hand, when we enter a variant to check the tax, the admin-ui correctly calculates the price with tax. We assume that this calculation is based on the price and the calculation is done correctly by the frontend (Angular): And in the order it is shown like this: |
I've spent some more time trying to reproduce this:
I'm not seeing the error. So looking at the code paths involved in calculating the tax-inclusive price of a variant, we can look at the vendure/packages/core/src/service/helpers/product-price-applicator/product-price-applicator.ts Lines 88 to 94 in fee995c
This is making a call to the configured |
Hi, thank you for taking a look at this. We are not using a custom |
Are you able to run the server locally in debug mode and set a breakpoint in the |
Hello, the problem was happening on a deployed docker container, I tried replicating the problem but couldn't, I had a feeling that the image we were using was the problem, we changed from node:18-alpine to 21-alpine3.18 and that seems to have fixed the issue, maybe something with that image was causing the problem but I am not sure. |
Wow that's bizarre! I really cannot begin to understand what might have caused this, that was fixed by changing the docker image 😱 The reason the default strategy uses a different rounding method is to keep backwards compatibility with Vendure v1.x behaviour. Both approaches could be considered valid. I'm going to close this now since we don't have a reliable reproduction. If it ever re-occurs and you have any other insight into related changes, we can reopen. |
The amounts shown in the reproduction and the ones we had are the result of the sum of the two numbers instead of the product: |
OK, thanks to the reproduction repo from @carathorys, I was able to get to the bottom of this: It only happens when the custom MoneyStrategy is set via a plugin's The reason that it breaks is that:
The solution in the referenced commit is to switch the order of operations in the bootstrap sequence to ensure we have collected all the plugin configs before we set the money strategy. |
Describe the bug
The property of ProductVariant priceWithTax is not being correctly calculated while using BigInt strategy for prices, priceWithTax is a concatenation of the price of the product variant and the calculated tax percentage of that price.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The price with tax should be the sum of the numbers and not the concatenation of the 2 values as if they were a string.
Environment:
Additional context
The text was updated successfully, but these errors were encountered: