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?

2 Answers 2


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';

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 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.