-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Invoice Grand Total wrong if discount applied #32270
Comments
Hi @HenKun. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. Please, add a comment to assign the issue:
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento give me 2.4-develop instance |
Hi @HenKun. Thank you for your request. I'm working on Magento instance for you. |
Hi @HenKun, here is your Magento Instance: https://da30135e1013b1413204ea32a3043e27-2-4-develop.instances.magento-community.engineering |
I'm seeing the same thing on Magento 2.4.2 CE. I'm not sure if there is some relation to these issues: Smaller discounts actually work fine in my case, but larger discounts (e.g. 90% or 100% off) result in the issue as described as above. If you look below, the Grand Total is £0.00 but the total paid by the customer is £54.17 |
@willryanuk I don't think these tickets are directly related. The tax is basically calculated correctly (against the assumptions in the linked tickets). As you see in your and my examples, the tax is 0 which is correct. However, the invoice grand total contains the hidden tax (which is the tax that would be applied without the discount) that results in
whereas the customer actually (and correctly) paid nothing since the order grand total is 0. So in my opinion the handling or application of the hidden tax is incorrect. And this is a large issue for us at the moment. |
@willryanuk are you sure smaller discounts work fine? I think the problem ist just not that obvious |
@HenKun unfortunately (and confusingly) it does indeed seem to invoice correctly for smaller discounts. E.g. here is a discount at 10% where the discount is calculated correctly, and the total paid is calculated correctly. So it only seems to happen for me for larger discounts such as 100%. |
Indeed, that seems to be correct. Since you seem to have a test setup at hand, can you check if a 99% discount gives correct or wrong results? |
OK, that's really weird. Let's wait if a Magento Developer has more insight into the problem. We can see in the last example that the tax calculation is again correct. So it's imho safe that it is not a problem with tax calculation per se. |
Same problem over here with a coupon with 100% discount on Magento 2.3.6. Total Paid amount is not zero but the amount is the tax of the order. |
This is probably related to #30853 |
@barryvdh Seems to be the same issue, correct. Especially the comment:
indicates why the large amount of 99% fails and the discount of 10% succeeds. Even more sad that this bug is present since 2.3.6 and known since Nov 2020 and not fixed yet. |
Fixed it for me as well. I waste a lot of time on Magento with bugs such as this. |
@JoostWan @willryanuk However, that does not work for me for discounts smaller than 100%. Given a discount of 90%, the invoice grand total is just 0. Can you check if this is only on my side? |
I'm having the same problem with 99% discount rates. |
@barryvdh Did you try the patch proposed by #30853 (comment) ? |
The patch in #30853 (comment) could not be applied, so I created it on my own:
I tested it with discounts of 0%, 40%, 50%, 90% and 100% All tests worked fine with my setting. (On M2.4.1) However, I am not sure what the commit c710c9b |
This is probably fixed by: MC-41438: 100% Discount cart rule results in Tax invoiced, which I'm guessing is going to be included in Magento 2.4.3 Maybe somebody can confirm this? |
Hi @engcom-Alfa. Thank you for working on this issue.
|
Hi @HenKun I have re tested it in the Magento ver. dev-2.4-develop, and it is worked as expected. Below are the screenshots of it. So, kindly update to the latest version and give a try. If you still face the issue, you may please report a new bug on the same. |
Yeah, just had to apply the patch you mentioned and that has fixed the issue for me |
Preconditions (*)
tax/calculation/price_includes_tax
=>1
tax/calculation/apply_after_discount
=>1
tax/calculation/discount_tax
=>1
Steps to reproduce (*)
Expected result (*)
Actual result (*)
Probable Reason
In
vendor/magento/module-sales/Model/Order/Invoice/Total/Tax.php
on line 121 the invoice grand total is set to:which resolves to:
The usage of
$totalDiscountTaxCompensation
is IMHO wrong when using these settings.We now have the scenario that the invoices show a grand total > 0 which is not resolvable for accounting since these amounts were never received from the customer.
Basically the same issue occurs if the discount is not 100%, just the amounts differ of course.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
The text was updated successfully, but these errors were encountered: