Magento2: Including Tax - wrong totals and subtotals displayed on cart and checkout

Created on 14 Dec 2016  Â·  34Comments  Â·  Source: magento/magento2


Preconditions


  1. PHP 7.0.8, MySQL 5.7.13
  2. Magento 2.1.2

Steps to reproduce

  1. Navigate to Stores -> Configuration -> Tax
  2. Set Default Tax Classes, Default Tax Destination Calculation
    (have some tax preconfigured for this)
  3. Calculation Settings -> Catalog prices: Including Tax (prices are entered with default tax on products)
  4. Shopping Card Display Settings -> Display Prices: Including Tax
  5. Shopping Card Display Settings -> Display Subtotal: Including Tax
  6. Shopping Card Display Settings -> Include Tax in Order Total: Yes

Expected result

  1. Total on Cart page should include tax
  2. Product prices, subtotals and totals on Checkout page should include tax. Final total should be correct, displaying what customer is paying.

Actual result

  1. Cart page is displaying total without tax
  2. Checkout page is displaying product prices, subtotals and total without tax. Tax is displayed separately, but never added to total, making final total wrong.


Some countries like Croatia have fixed predefined tax and prices are entered with tax included on products. Default tax country is set and all prices should be displayed Including Tax through the system.

Magento is ignoring those settings on cart and checkout, so customers see one total (without tax), but they are charged with another (with tax) when placing order!!

For example, I see that /totals-information API on cart is always returning grand_total - tax, ignoring above configuration, and javascript is just displaying that value, even though grand_total in db is correct.

Regards,
Ivan

Tax Clear Description Format is valid needs update bug report

Most helpful comment

This worked for me:
Change grand-total component in checkout_cart_index to Magento_Tax/js/view/checkout/summary/grand-total

Thanks to @tomdollarmpd

All 34 comments

Further analysis shows, if I set "Include Tax in Order Total: No", then total is right and tax is included in total (when product prices include tax like explained above).
I'm not sure if I don't understand this setting or it's a bug?

But this also works only on some setups and not another ..
Magento_Tax module rewrites some UI components from its layouts. For example, if Tax module is enabled, grand-total.html should be loaded from Tax module and not Checkout module.

However, I have live site with php 7.0.11 where grand-total.html is loaded from Checkout module, displaying wrong total. It's like UI component rules defined in Magento_Tax layouts are ignored.

I think this is related to how modules are sorted in app/etc/config.php, because Magento_Tax is sometimes loaded before Magento_Checkout (doesn't work) and sometimes after (works).

I have the same issue also. Making sure that Mage_Tax module is loaded after Mage_Checkout resolves issue for cart, but Onestep checkout (Magento standard, not a third-party module) still displays shipping and items in summary excluding tax.

Is it possible to change the loading sequence of the core modules without touching the core files?

Edit: I created my own custom module with only module.xml + registration.php files in module.
In the module.xml file I added:
<sequence> <module name="Magento_Checkout"/> <module name="Magento_Tax"/> </sequence>

Then the modules got the correct order in config.php and checkout worked as expected.

Under tax -> shipping settings have you set the origin country to the correct country?

just to share, I had a similar issue where the prices in the catalogue, cart and orders were fine, but the sidebar on the checkout refused to add tax to the order summary - turned out to be an issue with layout file Magento_Checkout/layout/checkout_index_index.xml from the Luma theme. The components loading in the sidebar were that of Magento_Checkout/js/view/summary/grand-total instead of Magento_Tax/js/view/checkout/summary/grand-total. Compare yours with the master copy (https://github.com/pepe1518/magento2/blob/master/vendor/magento/module-tax/view/frontend/layout/checkout_index_index.xml) to confirm if you have the same issue.

Similar issue in MCE 2.1.3.

My goal was to show the same product on two websites (once including tax, once excluding tax, e.g. on "checkout/cart" page).

I have added two modules with sequence dependency to "Magento_Tax", which results in a different module loading order in "app/etc/config.php" ("Magento_Checkout" after "Magento_Tax"). The (js/knockout) file grand-total.html was included from "Magento_Checkout" not from "Magento_Tax" module, because Layout XML merging of both modules was done in the wrong direction.

Magento Team Todos:
1) Review all core modules for correct or missing module sequence dependencies.
2) Refactor module sequence (config.php) generation.

Regarding 2): Some strange behaviour occured here: Adding a module with a sequence entry to one Magento core module changes also loading order of other Magento core modules...

BTW: I had also an issue with loading correct Magento_Tax configuration, where the scope is restricted t o "website" scope. It looks like Magento can not fetch "parent" setting if scope "store" and Store model is used to fetch the config information which is configured for scope "website".

Unfortunately, I could not reproduce the issue as you described it. Can you reproduce this issue on latest version of Magento2?

I can reproduce this issue in latest m2 version.

Magento CLI version 2.1.7
PHP 7.0.18-0ubuntu0.16.04.1 (cli) ( NTS )
10.1.24-MariaDB-1~xenial

Hi @swayoleg
Please add a screenshot of "cacluculation setting" section

Hi @swayoleg.
This is not a bug.
For example:
After setting: "cacluculation setting" section -> "Catalog Prices" select "Including Tax"(The tax is already included in the price of the product)
Go to admin -> catalog ->product ->simple product: (price = 100$, tax = 100%) it means: the product price without tax = 50$ and tax = 50$.

@oleg-onufer: I think, that the minimum required solution is a sequence definition between the two modules Magento_Checkout and Magento_Tax, so that the Tax module is loaded after the Checkout module (to get the right templates loaded in frontend).

@swayoleg: Can you determine the order of the two modules in your app/etc/config.php file?

@oleg-onufer: The problem or obscurity is that a sequence definition between any (e.g. "custom to custom" or "custom to core") modules can lead to the changed order of these two modules (checkout, tax => tax, checkout) in config.php. Note: The problem occurs with no (direct) relation regarding to the two modules.

This circumstance makes it hard to name a case with that the issue can be reproduced. I think you have to add some custom or third-party modules to see the module order changed in the config.php.

Theme Issue ...
I came across with this issue. Problem is a theme has a layout file name checkout_cart_index.xml in Magento_Checkout/layout directory, they would want to customize something. But I could not find another file with same name in Magento_Tax/layout directory, so I copied a original version of checkout_car_index.xml file ( is of Magento Tax module) to such theme directory. Then it works!

Version : 2.1.3

The problem exist still in Magento 2.1.7. The Grand Total in Cart display only the Total Price without Tax.

Unfortunately, we could not reproduce the issue as you described it. We need more information about this issue in order to successfully investigate potential fixes. Please describe each step of the procedure you followed, what changes you made to the configuration.

@zhulak we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

@ivanweiler, we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

Same issue on Magento 2.1.9
Magento_Checkout after Magento_Tax

This worked for me:
Change grand-total component in checkout_cart_index to Magento_Tax/js/view/checkout/summary/grand-total

Thanks to @tomdollarmpd

I have the same issue. @magento-engcom-team how you can say that you can't reproduce this bug? I think the screenshot and the desription desicribe the process correct.
And @oleg-onufer why is this not a bug? Two magento core modules should do not the same thing with the calculation! I think one of this module should check what the other modul do!

in the past i like magento, but with magento 2... there are to many bugs over a long time. and they are still open and not really fixed. :((((

@keinereiner Yeah... Everyone is saying that. They close tickets, making them"fixed on 2.2" as if 2.0, 2.1 were totally obsolete...

They don't understand that hiding reality is worse than admitting that Magento 2 should never have been released for production site so early... And that we are all fucked up selling it.

@pravalitera Agree, M2 is far from being ready for production, but M1 is obsolete. So there is no other way then moving forward, supporting each other in the community and reporting bugs.

@erikkubica Maybe 2.2 is ok for a production, i haven't tested it yet. But for 2.0 and 2.1, so many incredible bugs... I don't really agree with "M1 obsolete"... Because when i have to sell M2 migration, really, it's difficult to explain "Yeah so, there is a lot of work, we have to redo all the code, and yes, you will not have any new feature. And slower. And it's gonna be harder for us to seek people that do proper code for M2. Here is the bill, thx you !"

2.2 is so much more stable. It's a shame many of the bugs haven't been fixed in the 2.0 and 2.1 branches, but I kind of understand Magento not wanting to support 3 distinct versions. We've been dragging around some standard 'oops fixes' in each 2.0/2,1 project that we whack straight in the vendor/magento folder, and am happy to report to we no longer need any of them. Not saying it's perfect, but it's getting there. If you can, upgrade ASAP.

My 2.1 and 2.0 are online for a long now... With all the "fixes" it
needed... But now, doing a migration to 2.2, makes me really afraid ^^ I
know i have to, but really, i saw people trying... and crying :D

i understand the "why they don't maintain 2.0 and 2.1", but their behaviour
on this git is done to make everyone angry... "Yeah i can't reproduce. Yeah
it is fixed it 2.2 or 2.3" . Why adding security updates to 2.0 and 2.1 if
they are considered "osbsolete" ? ...

2018-01-22 17:56 GMT+01:00 Tom Dollar notifications@github.com:

2.2 is so much more stable. It's a shame many of the bugs haven't been
fixed in the 2.0 and 2.1 branches, but I kind of understand Magento not
wanting to support 3 distinct versions. We've been dragging around some
standard 'oops fixes' in each 2.0/2,1 project that we whack straight in the
vendor/magento folder, and am happy to report to no longer need any of
them. Not saying it's perfect, but it's getting there. If you can, upgrade
ASAP.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/magento/magento2/issues/7801#issuecomment-359490887,
or mute the thread
https://github.com/notifications/unsubscribe-auth/APqjaIXSDARjEDcx8wNr1dI_IlOmfOmVks5tNL3IgaJpZM4LNWNa
.

@pravalitera totally understand the fear, but you may be pleasantly surprised. We did 2 upgrades last week and the one I was really worried about took less than a day, and the second was less than that. The real power of Magento is in it's community, so if you need any help, feel free to drop me a line and I'll gladly help if I can: [email protected]

Reopen due to new activity in #16096

I have same issue in 2.2.4 as well

@harleen-mann, please provide more detailed steps to reproduce, as we were not able to reproduce this issue.
default

Hi

It is not showing tax in order total only on shopping cart page , on checkout page it seems fine
screen shot 2018-08-17 at 14 40 59
screen shot 2018-08-17 at 14 40 36

And i am using following settings in the backend
screen shot 2018-08-17 at 14 42 56

then i had to change component from Magento_Checkout/js/view/summary/grand-total to Magento_Tax/js/view/checkout/cart/totals/grand-total for grand-total in file checkout_cart_index.xml to make it work.

@harleen-mann, thank you for the clarification, but anyway issue is not reproducible.
default
Please try to reproduce this issue on the clean installation on the latest Magento release.

We are closing this issue due to inactivity. If anyone wants to update it, please reopen the issue.

Was this page helpful?
0 / 5 - 0 ratings