Skip to content

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

@dankocherga

Description

@dankocherga

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Event: distributed-cdDistributed Contribution DayFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions