Skip to content

Tax rate + 100% discount results in negative grand total #10790

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

Closed
dankocherga opened this issue Sep 6, 2017 · 13 comments
Closed

Tax rate + 100% discount results in negative grand total #10790

dankocherga opened this issue Sep 6, 2017 · 13 comments
Labels
Event: distributed-cd Distributed Contribution Day Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release

Comments

@dankocherga
Copy link

Setting up tax a rule and applying 100% discount in the shopping cart results in a negative grand total.

Preconditions

  1. Magento 2.1.7

Steps to reproduce

Admin setup

  1. Create product A with price = 2 762,71
  2. Create product B with price = 2 542,37
  3. Setup tax rule 18%
  4. Create coupon code that adds 100% discount.

Front-End

  1. Add both products to the cart with qty = 2
  2. Apply coupon code

Expected result

  1. Grand total (without shipping yet calculated) = 0

Actual result

  1. Grand total is -0,01

Calculating by hand

Product Qty Price Row total Row Tax
A 2 2762,71 5525,42 994,5756
B 2 2542,37 5084,74 915,2532
Total Expected Amount
subtotal 10610,16
tax 1909,8288

How Magento calculates it
Putting a debugger at Magento\Quote\Model\Quote\Address\Total\Grand we could see:

2017-09-06 11 35 27

Tax amount is rounded and it makes the total sum to be 10610,16 + 1909,83 - 12520 = -0,01

@magento-engcom-team magento-engcom-team added G1 Passed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 6, 2017
@Andrii-Deineha
Copy link
Contributor

Hi @dankocherga, Thanks for reporting this issue. Unfortunately, I could not reproduce the issue as you described it.
tax rate 100 discount results

@magento-engcom-team
Copy link
Contributor

@dankocherga Please provide the detailed steps we must follow to reproduce this issue. Screenshots or logs would be helpful, too.

@dankocherga
Copy link
Author

dankocherga commented Sep 21, 2017

@magento-engcom-team
I have created a Magento database back-up with products and tax rates prepared: https://www.dropbox.com/s/i5kxzqg671zb9nh/1505994954_db_demo.sql.sql.zip?dl=0

Screenshot of the issue in the cart:
2017-09-21 14 57 37

Screenshots of my tax settings:
2017-09-21 14 58 40

2017-09-21 14 58 47

2017-09-21 14 58 53

@okorshenko
Copy link
Contributor

@dankocherga thank you for update

@magento-engcom-team
Copy link
Contributor

@dankocherga, thank you for your report.
We've created internal ticket(s) MAGETWO-77433 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Sep 25, 2017
@jonashrem
Copy link
Contributor

I'm working on it #SQUASHTOBERFEST

@jonashrem
Copy link
Contributor

I see this is quite more complicated, than I initially assumed. So I would like to let this handle someone more experienced with magento2 code.

Please reassign this one.

@jonashrem
Copy link
Contributor

@okorshenko please remove my assignment here.

Sorry for the trouble.

@Ctucker9233
Copy link

Backport to 2.2 created #22188

ilnytskyi added a commit to ilnytskyi/magento2 that referenced this issue Apr 8, 2019
ilnytskyi added a commit to ilnytskyi/magento2 that referenced this issue Apr 8, 2019
ilnytskyi added a commit to ilnytskyi/magento2 that referenced this issue Apr 8, 2019
ilnytskyi added a commit to ilnytskyi/magento2 that referenced this issue Apr 8, 2019
ilnytskyi added a commit to ilnytskyi/magento2 that referenced this issue Apr 8, 2019
ilnytskyi added a commit to ilnytskyi/magento2 that referenced this issue Apr 8, 2019
ilnytskyi added a commit to ilnytskyi/magento2 that referenced this issue Apr 8, 2019
ilnytskyi added a commit to ilnytskyi/magento2 that referenced this issue Apr 8, 2019
ilnytskyi added a commit to ilnytskyi/magento2 that referenced this issue Apr 8, 2019
ilnytskyi added a commit to ilnytskyi/magento2 that referenced this issue Apr 8, 2019
ilnytskyi added a commit to ilnytskyi/magento2 that referenced this issue Apr 8, 2019
@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Apr 15, 2019
magento-engcom-team added a commit that referenced this issue Apr 15, 2019
…ied with tax calculation #10790 #22227

 - Merge Pull Request #22227 from ilnytskyi/magento2:2.2-develop-PR-port-14468
 - Merged commits:
   1. f68cff7
   2. 8501089
   3. 7bbc018
   4. b30b1bb
   5. a7f65ac
   6. 0d1a0b0
   7. ea79937
   8. ec8bbce
   9. 17f7b77
   10. d5be0aa
   11. 98a1561
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Event: distributed-cd Distributed Contribution Day Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release
Projects
None yet
Development

No branches or pull requests

8 participants