1

In a Magento 2 project, I would like to change the label "Shipping" to "Shipping & Surcharge" on all the summary section on both frontend and backend.

Is there any easy way and one step to do for this like in Magento 1.x.

In Magento 1.x we can update the CSV file for this.

Please suggest your ideas to implement the change

1

In Magento 2 you can find language specific files at module level i18n folder

In your case you can find the string.

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

You can modify as you want, but as per the standards you need to override by new module and add the changes in your module.

Reference

Hope this help.

1
  • Hi @krishna at i95Dev, thank you for your comment. I tried it and it works. – Gideon Sep 6 '16 at 5:48
2

The Above way can be Affect another Language Translation if some other page has the word "Shipping", so Try to Make change The checkout_cart_index.xml as below

<item name="shipping" xsi:type="array">
    <item name="component"  xsi:type="string">Magento_Checkout/js/view/cart/totals/shipping</item>
    <item name="config" xsi:type="array">
        <item name="title" xsi:type="string" translate="true">Shipping</item>
        <item name="template" xsi:type="string">Magento_Checkout/cart/totals/shipping</item>
    </item>
</item>

TO

<referenceContainer name="checkout.cart.totals.container">
            <referenceBlock name="checkout.cart.totals">
                <arguments>
                    <argument name="jsLayout" xsi:type="array">
                        <item name="components" xsi:type="array">
                            <item name="block-totals" xsi:type="array">
                                <item name="children" xsi:type="array">
                                    <item name="shipping" xsi:type="array">
                                        <item name="component" xsi:type="string">Magento_Checkout/js/view/cart/totals/shipping</item>
                                        <item name="config" xsi:type="array">
                                            <item name="title" xsi:type="string" translate="true">Shipping-modifythis</item>
                                            <item name="template" xsi:type="string">Magento_Checkout/cart/totals/shipping</item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </argument>
                </arguments>
            </referenceBlock>
        </referenceContainer>

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.