Magento2: Move Order Total Excl. Tax after the Shipping amount in Order Summary in magento2

magento.stackexchange https://magento.stackexchange.com/questions/302625

سؤال

I want to move order total excl. tax after the shipping amount in order summary.

enter image description here

Any help would be appreciate. Thank you

هل كانت مفيدة؟

المحلول

This is how i achieved it. Move element is not possible for it so i found another way.

I created a new module like

app\code\Vendor\Module\etc\module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_Module" setup_version="0.0.1">
    </module>
</config>

app\code\Vendor\Module\registration.php

app\code\Vendor\Module\view\frontend\layout\checkout_index_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.root">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="checkout" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="sidebar" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="summary" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <item name="totals" xsi:type="array">
                                                    <item name="children" xsi:type="array">

                                                        <item name="some_text" xsi:type="array">
                                                            <item name="sortOrder" xsi:type="string">35</item>
                                                            <item name="component" xsi:type="string">Vendor_Module/js/subTotal</item>
                                                            <item name="config" xsi:type="array">
                                                                <item name="template" xsi:type="string">Vendor_Module/subtotal</item>
                                                            </item>
                                                        </item>

                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

app\code\Vendor\Module\view\frontend\web\js\subTotal.js

define([
    'Magento_Checkout/js/view/summary/abstract-total',
    'Magento_Checkout/js/model/quote',
    'Magento_Catalog/js/price-utils',
    'Magento_Checkout/js/model/totals'
], function (Component, quote, priceUtils, totals) {
    'use strict';


    return Component.extend({
        defaults: {
            template: 'Vendor_Module/subtotal'
        },
        totals: quote.getTotals(),

        getGrandTotalExclTax: function () {
            var total = this.totals();

            if (!total) {
                return 0;
            }

            return this.getFormattedPrice(total['grand_total']);
        }
    });
});

app\code\Vendor\Module\view\frontend\web\template\subtotal.html

<tr class="order_total">
    <th class="mark" scope="row">
        <span class="label" data-bind="i18n: 'Order Total Excl. VAT' "></span>
    </th>
    <td class="amount">
        <span class="label" data-bind="text: getGrandTotalExclTax() "></span>
    </td>
    </tr>

نصائح أخرى

You can manage it from admin

Path : Store > Config > Sales > Sales > Checkout Totals Sort Order

enter image description here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top