Skip to content
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

Wrong order tax amounts displayed when using specific tax configuration #10347

Closed
jreinke opened this issue Jul 27, 2017 · 8 comments
Closed
Assignees
Labels
bug report 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 Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@jreinke
Copy link

jreinke commented Jul 27, 2017

Preconditions

  1. Magento CE 2.1 with sample data installed
  2. PHP 7 (does not matter IMHO)
  3. MySQL 5.7 (does not matter IMHO)

Steps to reproduce

  1. Go to Magento admin
  2. Create the following tax rates (Stores > Tax Zones and Rates):
Tax Identifier Country Zip State Rate
Tax1 France * * 10%
Tax2 France * * 5%
Tax3 France * * 20%
  1. Create the following tax rules (Stores > Tax Rules):
Name Tax Rate Customer Tax Class Product Tax Class Priority Sort Order
Tax1 Tax1 Retail Customer Taxable Goods 0 0
Tax2 Tax2 Retail Customer Taxable Goods 1 0
Tax3 Tax3 Retail Customer Taxable Goods 1 0
  1. Enable full tax summary display in "Stores > Configuration > Sales > Tax > Orders, Invoices, Credit Memos Display Settings > Display Full Tax Summary"
  2. Go to frontend and click on category "Gear > Bags"
  3. Add product "Strive Shoulder Pack" to cart (qty = 1)
  4. Go to checkout
  5. Continue as guest or as authenticated user
  6. Provide shipping address with country France (according to tax country configured in step 2)
  7. Place order
  8. Go to order details page

Expected result

Tax total amount should be equal to the sum of the tax details amounts (12.00 for this use case)

Actual result

Tax details sum is equal to 11.20
magento2 issue tax details amounts

Thanks!

@choukalos
Copy link

Questions:

  • What country is this for?
  • Can you share details on what are the 3 taxes you need to collect?
  • What is your tax configuration?
  • Are product prices loaded including tax?
  • What's your shipping origin set to?

Thanks!
Chuck

@jreinke
Copy link
Author

jreinke commented Aug 3, 2017

Hi,

This is not for a specific purpose but this configuration comes with our internal test cases. France is just an example, you can test with another country if you want.

All other configurations are the Magento default ones. Nothing else has been modified. Just make a fresh install, follow the steps to reproduce and you should be able to reproduce the bug.

I had to debug this by myself and I think the bug may come from this code:

$percentSum is never used while it should be instead of $rates['percent'].

A fix suggestion could look like this:

$percentSum = 0;
array_walk($taxRates, function($rate) use ($percentSum) {
    $percentSum += $rate['percent'];
});
foreach ($taxRates as $rate) {
    $realAmount = $rates['amount'] * $rate['percent'] / $percentSum;
    $realBaseAmount = $rates['base_amount'] * $rate['percent'] / $percentSum;
    $ratesIdQuoteItemId[$rates['id']][] = [
        'id' => $taxesArray['item_id'],
        'percent' => $rate['percent'],
        'code' => $rate['code'],
        'associated_item_id' => $taxesArray['associated_item_id'],
        'item_type' => $taxesArray['type'],
        'amount' => $rates['amount'],
        'base_amount' => $rates['base_amount'],
        'real_amount' => $realAmount,
        'real_base_amount' => $realBaseAmount,
    ];
}

Thanks

@jreinke
Copy link
Author

jreinke commented Aug 11, 2017

Hi team,

Any feedback on this please?

@magento-engcom-team magento-engcom-team added G1 Passed bug report Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team magento-engcom-team added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed 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 18, 2017
@magento-engcom-team
Copy link
Contributor

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

@PieterCappelle
Copy link
Contributor

Please assign this to me. I'll be working on this one, as I have the same problem in one of our projects.

@miguelbalparda
Copy link
Contributor

miguelbalparda commented Oct 21, 2017

Thanks a lot @PieterCappelle!!! There is a proposed fix for this @jreinke, can you check it and report back?

okorshenko pushed a commit that referenced this issue Nov 21, 2017
…hen using specific tax configuration (2.3-develop) #11594

 - Merge Pull Request #11594 from PieterCappelle/magento2:fix_2_3_issue_10347
 - Merged commits:
   1. 4aec05b
okorshenko pushed a commit that referenced this issue Nov 21, 2017
…hen using specific tax configuration (2.3-develop) #11594
okorshenko pushed a commit that referenced this issue Nov 21, 2017
…hen using specific tax configuration (2.2-develop) #11592

 - Merge Pull Request #11592 from PieterCappelle/magento2:fix_2_2_issue_10347
 - Merged commits:
   1. 158e47e
okorshenko pushed a commit that referenced this issue Nov 21, 2017
…hen using specific tax configuration (2.2-develop) #11592
@okorshenko
Copy link
Contributor

The issue has been fixed and delivered to 2.2-develop and 2.3-develop

@okorshenko okorshenko added 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 labels Nov 21, 2017
okorshenko pushed a commit that referenced this issue Nov 22, 2017
…hen using specific tax configuration (2.1-develop) #11593

 - Merge Pull Request #11593 from PieterCappelle/magento2:fix_2_1_issue_10347
 - Merged commits:
   1. a716df9
   2. 1a3d5d3
okorshenko pushed a commit that referenced this issue Nov 22, 2017
…hen using specific tax configuration (2.1-develop) #11593
@irshad-iflair
Copy link

irshad-iflair commented Feb 12, 2020

@jreinke: I am struggling for how can I display separate tax rates on the product on selected stores please refer to this. 1> https://magento.stackexchange.com/questions/303861/magento-2-3-x-how-can-customise-tax-rules-for-different-stores-for-common-count

2>#26831

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report 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 Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

8 participants