3

I want to modify this label

enter image description here

Its from "checkout.cart.totals" block in magento\vendor\magento\module-checkout\view\frontend\layout\checkout_cart_index.xml , and I'm pretty sure its this chunk of code that handles the label

<item name="grand-total" xsi:type="array">
    <item name="component"  xsi:type="string">Magento_Checkout/js/view/summary/grand-total</item>
    <item name="config" xsi:type="array">
        <item name="title" xsi:type="string" translate="true">Order Total</item>
        <item name="template" xsi:type="string">Magento_Checkout/cart/totals/grand-total</item>
    </item>
</item>

so I changed that chunk of code like so:

<item name="grand-total" xsi:type="array">
    <item name="component"  xsi:type="string">Magento_Checkout/js/view/summary/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>

I just changed the title from Order Total to Grand Total.
But nothing changed. Front end still shows Order Total. Did I missed something?

  • Have you clear cache? – Rakesh Jesadiya Jun 6 '17 at 8:43
  • Nevermind, I know the problem. Its the wrong xml – zekkai Jun 6 '17 at 8:47
3

You can also change Order Total label at

Core File:

vendor/magento/module-checkout/i18n/en_US.csv

Theme File:

app/design/frontend/Vendor/theme/Magento_Checkout/i18n/en_US.csv

Change this

"Order Total","Your Custom Title"
  • I see. However it's not my preferred way because it edits the translation file. Deep deep inside.. the value is still 'Order Total'. Thanks for different approach. – zekkai Jun 6 '17 at 8:57
3

My bad. Using Knockoutjs context debugger, I can see the template is coming from Magento_Tax/checkout/cart/totals/grand-total. So the right xml would be magento\vendor\magento\module-tax\view\frontend\layout\checkout_cart_index.xml

and the code to be edited is this:

<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="template" xsi:type="string">Magento_Tax/checkout/cart/totals/grand-total</item>
    <item name="exclTaxLabel" xsi:type="string" translate="true">Grand Total Excl. Tax</item>
    <item name="inclTaxLabel" xsi:type="string" translate="true">Grand Total Incl. Tax</item>
    <item name="title" xsi:type="string" translate="true">Grand Total</item>
</item>


- edit: Found another way to do it without modifying the magento component.

I create this file app\design\frontend\Vendor\theme\Magento_Checkout\layout\checkout_cart_index.xml

with this content

<?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.cart.totals">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <!-- UI component customizations -->
                    <item name="components" xsi:type="array">
                        <item name="block-totals" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="grand-total" xsi:type="array">
                                    <item name="config" xsi:type="array">
                                        <item name="title" xsi:type="string" translate="true">Grand Total</item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

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.