1

I have a simple plugin in magento 2 that modifies the name of the products, but I can not find the function that modifies the description

public function afterGetName(\Magento\Catalog\Model\Product $subject, $result)
{
   return '|' . $result . ' - Test';
}

So modified the names of the products, I also have the function to modify the prices but what is the function to modify the description?

0

You can use plugin for all setter getters from product model. So to change description you can use

public function afterGetDescription(\Magento\Catalog\Model\Product $subject, $result)
{
   return '|' . $result . ' - Test';
}
0

Try to modify the getData($key) function. They usually call getDescription() or getData("description") to get the description.

Basically, in the system it always calls getData("description") function so you can modify that function to change the result.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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