2

I follow this link Change Shopping Cart Title to change Shopping cart to some text via language package.

I need to change Programmaticly Shopping cart Page title to MyCart

I try this

app/design/vendor/theme/Magento_Checkout/layout/checkout_cart_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">
       <head><title> My Cart</title></head>

    </page>

Its not Working for me, Suggest me How to Do this...

1 Answer 1

3

You need to override here /app/code/Magento/Checkout/Controller/Cart/Index.php

find the below line

$resultPage->getConfig()->getTitle()->set(__('Shopping Cart'));

and change to

$resultPage->getConfig()->getTitle()->set(__('Whatever Title You Need'));

for alternate solution you can create own module that contains a translation file i18n/en_US.csv. here you can translate your phrase

'Shopping Cart','Whatever Title You Need'

for one more alternate solution you can try with in your theme too

magento2/app/design/frontend/Vendor/Theme/i18n/en_US.csv

'Shopping Cart','Whatever Title You Need'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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