Question

How to Change Up-Sell text in Product Edit from admin(Products -> Catalog-> Edit) in Magento 2.

Was it helpful?

Solution

The text "Up-Sell Products" is present inside the file vendor/magento/module-catalog/Ui/DataProvider/Product/Form/Modifier/Related.php line 341. If you open the file you will notice that the text is enclosed with a __('Up-Sell Products') which means its multi-locale ready.

So you can simply use the i18n\en_US.csv file inside your custom theme or a custom module to change the text from "Up-Sell Products" to whatever you want.

Reference file vendor/magento/module-catalog/i18n/en_US.csv line 438.

This way is much simpler and doesn't require any kind of module overwriting.

OTHER TIPS

Try below code, You need to override vendor/magento/module-catalog/Ui/DataProvider/Product/Form/Modifier/Related.php

and change Up-sell to any other.

di.xml:

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <preference for="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Related" type="Vendor\Module\Ui\DataProvider\Product\Form\Modifier\Related" />
</config>

create Related.php into following file vendor\Module\Ui\DataProvider\Product\Form\Modifier;

Copy and Paste Related.php form vendor/magento/module-catalog/Ui/DataProvider/Product/Form/Modifier/Related.php

And change UP-sell Related text to what ever you want.

Clear Cache, and Check it. let me know if you have any issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top