2

I am designing a theme in Magento 2 using blank theme as parent theme. I would like to change text on some of the the top links like this:

From "Compare Products 1 items" into "Compare (1)"

From "My Wish List 1 items" into "Wish List (1)"

From "My Cart 1 items" into "Cart (1)"

How do I accomplish that?

1

In your theme create i18n/en_US.csv with the following

"Compare Products %1 items","Compare (%1)"
"My Wish List %1 items","Wish List (%1)"
"My Cart %1 items","Cart (%1)"

See https://github.com/magento/magento2/tree/develop/app/design/frontend/Magento/luma/i18n

  • This is the best solution to use because you can make the change for individual languages without the need for writing a plugin, overriding code files or worse, editing core files. Translation files should always be used where possible! – Liam McArthur Feb 7 '18 at 14:08
0

you have to do it though plugin also

write plugin for getLabel() function for below class

vendor\magento\module-wishlist\Block\Link.php
vendor\magento\module-checkout\Block\Cart\Link.php

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.