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
Calculate tax with decimal precision and distribute proportionally across order items #13824
Conversation
Original author of the slack submission here. Just tested this version of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey folks!
thanks for bringing it up and the test that directly resolves the requested case.
However, I'm wondering what is the proper way of solving it from the taxation point of view. If I understood the current implementation the part that we are missing in each iteration is added to every 3rd element, which results in a slightly different tax percentage on these particular elements. On the other hand, we are having proper grand totals. I was thinking that moving the precision point could help us as well, but this solution seems to be more precise.
In the end, I don't have enough knowledge to make a call here. @CoderMaggie could you take a look into it from the PO perspective? Another option for me would be to dig into the tax calculation domain 😅
In my case the issue was pretty simple, The What I don't understand is how nobody had this issue before ? we saw with @vvasiloi that my use case is particular because :
Point number 1 seems to be the core issue here, and it's pretty easy to see why : Maybe it's explained better this way. :) |
@lchrusciel not really, I just used |
To add to the previous reply if I take my example again with the new implementation, I would have one tax adjustement amount at |
@GSadee Yes, you've missed the fact that the scenario to reproduce it is to have 20 order items, not 1 order item with 20 qty. See the test case. |
42578d7
to
bf0e2a9
Compare
6671ab0
to
47066dd
Compare
src/Sylius/Component/Core/Taxation/Applicator/OrderItemsTaxesApplicator.php
Outdated
Show resolved
Hide resolved
47066dd
to
9a41c8c
Compare
src/Sylius/Component/Core/Taxation/Applicator/OrderItemsTaxesApplicator.php
Show resolved
Hide resolved
src/Sylius/Component/Core/Taxation/Applicator/OrderItemsTaxesApplicator.php
Outdated
Show resolved
Hide resolved
src/Sylius/Component/Core/Taxation/Applicator/OrderItemsTaxesApplicator.php
Outdated
Show resolved
Hide resolved
6e03a01
to
a4af0f8
Compare
Thanks, Victor! 🥇 |
Thank you for finishing this! |
…(GSadee) This PR was merged into the 1.13 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.13| | Bug fix? | no | | New feature? | no | | BC breaks? | no | | Deprecations? | yes <!-- don't forget to update the UPGRADE-*.md file --> | | Related tickets | #13824 and #15184 | | License | MIT | <!-- - Bug fixes must be submitted against the 1.12 branch - Features and deprecations must be submitted against the 1.13 branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html --> Commits ------- Trigger deprecations in taxes applicators
Attempt to solve the issue of decimal values being lost during tax calculation on item level which leads to a wrong tax total at the order level.
Issue reported by @ikamikaz3 via Slack (full thread):