4

For upsell products in Magento2, how can edit the text above the upsell products that says: "We found other products you might like!"

I would like it to say "Customers also viewed"

1
  • We can found this text in: vendor/magento/module-catalog/view/frontend/templates/product/list/items.phtml. However, I think the new text is different meaning from the old one. Is there a specific reason for this change? – Khoa TruongDinh Aug 5 '17 at 3:02
4

With Custom Theme:

Override items.phtml in your theme, Copy items.phtml

From:

vendor/magento/module-catalog/view/frontend/templates/product/list/items.phtml

To

app/design/frontend/Vendor/theme/Magento_Catalog/templates/produc‌t/list/items.phtml

Now change

$title = __('We found other products you might like!');

to

$title = __('Customers also viewed');

Flush cache and try.

With Custom Module:

Create catalog_index_index.xml at app/code/Vendor/Module/view/frontend/layout

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="product.info.upsell">
            <arguments>
                <argument name="template" xsi:type="string">Vendor_Module::product/list/items.phtml</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

Copy vendor/magento/module-catalog/view/frontend/templates/product/list/items.phtml to app/code/Vendor/Module/view/frontend/templates/product/list/items.phtml

Now change

$title = __('We found other products you might like!');

to

$title = __('Customers also viewed');

Flush cache and try.

0
0

Rewrite template vendor\magento\module-catalog\view\frontend\templates\product\list\items.phtml line 80 from

$title = __('We found other products you might like!');

to

$title = __('Customers also viewed');
0

I realise this is an old question but here is a different approach than already suggested:

The $title is already inside a translatable string, therefore instead of over-riding the entire items.phtml file, you can add a translation file (.csv) inside your theme. Over-riding the entire file should be avoided when it's not absolutely needed as it can be hard to spot if an update to that file has been added with any further updates.

Place your translation file here:

Vendor/Theme/i18n/en_GB.csv

With the contents:

"We found other products you might like!","Customers also viewed"

This can be changed for any locale your site has.

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.