Magento – Order totals showing wrong way around

cartcheckoutmagento2totals

How can I change the position of the order totals (incl. tax / excl. tax) in the tax calculation? As it should show the total including tax below the total excluding tax but at the moment it does not.

screenshot

Best Answer

Other than the single totals (subtotal, tax, shipping, discount) which you can reorder in Stores > Configuration > Sales > Sales > Checkout Totals Sort Order, the grand totals are hard coded in the template

Magento/Tax/view/frontend/web/template/checkout/cart/totals/grand-total.html

<tr class="grand totals incl">
    <th class="mark" scope="row">
        <strong data-bind="i18n: inclTaxLabel"></strong>
    </th>
    <td data-bind="attr: {'data-th': inclTaxLabel}" class="amount">
        <strong><span class="price" data-bind="text: getValue()"></span></strong>
    </td>
</tr>
<tr class="grand totals excl">
    <th class="mark" scope="row">
        <strong data-bind="i18n: exclTaxLabel"></strong>
    </th>Magento/Tax/view/frontend/web/template/checkout/summary/grand-total.html
    <td data-bind="attr: {'data-th': exclTaxLabel}" class="amount">
        <strong><span class="price" data-bind="text: getGrandTotalExclTax()"></span></strong>
    </td>
</tr>

Override this template in your theme and change the order of these two <tr> table rows.

This template is for the cart. For the checkout summary, do the same in Magento/Tax/view/frontend/web/template/checkout/summary/grand-total.html

Related Topic