4

We are having a problem in our Magento 2 shop. All tax settings are set and everywhere he is showing the tax good, so also in the checkout and on orders, the only place were he is not showing the price including tax is in the shopping cart.

We have set the tax settings as shown below and should be good. We also tried to set the "include tax in order total" to no, but this is also not working.

Does anyone know how we can fix this?

enter image description here

1
  • Have you tried reverting back to Magento's default theme and testing the cart page? Feb 22 '17 at 21:33
5

in grand-total.js,

change:

getPureValue: function() {
    var totals = quote.getTotals()();
    if (totals) {
        return totals.grand_total;
    }
    return quote.grand_total;
},

to:

getPureValue: function() {
    var totals = quote.getTotals()();
    if (totals) {
        return totals.base_grand_total;
    }
    return quote.base_grand_total;
},
2
  • It worked, but why? In my case at least I've set both tax total and tax base total, so why one of them will have the value and the order not? Nov 16 '20 at 3:45
  • @ivanaugustobd this works because Magento substracts the tax amount in vendor/magento/module-checkout/Model/Cart/CartTotalRepository.php at 112 so use base_grand_total as an alternative value
    – Lan Nguyen
    Jul 1 at 16:02
5

I had the similar issue. This worked for me:

Change grand-total component in checkout_cart_index.xml in Magento_Checkout module(under Magento_Checkout/layout in your theme Directory) to Magento_Tax/js/view/checkout/cart/totals/grand-total

<item name="grand-total" xsi:type="array">
      <item name="component"  xsi:type="string">Magento_Tax/js/view/checkout/cart/totals/grand-total</item>
      <item name="config" xsi:type="array">
            <item name="title" xsi:type="string" translate="true">Grand Total</item>
            <item name="template" xsi:type="string">Magento_Checkout/cart/totals/grand-total</item>
      </item>
</item>
1
  • 1
    Any idea what the fix would be if it shows the tax in the cart, but doesn't add it to the grand total? Shows subtotal, shipping, tax, and then order total. Order total includes the subtotal and shipping but totally skips tax. Can't seem to get it to actually charge the tax.
    – Octoxan
    Jul 12 '19 at 13:24
1

To add the tax value in the grand total of the cart page you must edit the grand-total.js file from:

/vendor/magento/module-checkout/view/frontend/web/js/view/summary/

But you cannot edit this core file so you must copy it to:

/app/design/frontend/[vendor]/[theme]/Magento_Checkout/web/js/view/summary/

and replace everything in grand-total.js with:

define(
    [
        'Magento_Tax/js/view/checkout/summary/grand-total'
    ],
    function (Component) {
        'use strict';

        return Component.extend({

            /**
             * @override
             */
            isDisplayed: function () {
                return true;
            }
        });
    }
);

After that run:

php bin/magento setup:upgrade

0
0

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

0

I had the same issue but it ended up being that a conflict with a third party extension. I used Chrome inspect element network tab to see if grand-total.js was loading. Turns out there were three separate files for this with the third party extension loading last.

Once I corrected this error everything functioned as intended.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.