Magento 2 giving error in plugin beforegetName

I am getting error while using plugin before have any one idea why it is happening? 
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Puneet\Test\Model\Plugin\Name::beforegetName(), 1 passed in /var/www/html/m2/vendor/magento/framework/Interception/Interceptor.php on line 121 and exactly 2 expected in /var/www/html/m2/app/code/Puneet/Test/Model/Plugin/Name.php:15 Stack trace: #0 /var/www/html/m2/vendor/magento/framework/Interception/Interceptor.php(121): Puneet\Test\Model\Plugin\Name->beforegetName(Object(Magento\Catalog\Model\Product\Interceptor)) #1 /var/www/html/m2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Model\Product\Interceptor->Magento\Framework\Interception\{closure}() #2 /var/www/html/m2/generated/code/Magento/Catalog/Model/Product/Interceptor.php(26): Magento\Catalog\Model\Product\Interceptor->___callPlugins('getName', Array, Array) #3 /var/www/html/m2/vendor/magento/module-catalog/Helper/Product/View.php(119): Magento\Catalog\Model\Product\Interceptor->getName() #4 /var/www/html/m2/vendor/magento/module-catalog/Helper/Product/View.php(28 in /var/www/html/m2/app/code/Puneet/Test/Model/Plugin/Name.php on line 15
My class and before method is.
<?php

/*
* Puneet_Test
* Name change
*/

namespace Puneet\Test\Model\Plugin;

class Name {
// public function aftergetName(\Magento\Catalog\Model\Product $subject, $result){
// return "SS: " . $result;
// }
public function beforegetName(\Magento\Catalog\Model\Product $subject, $name){
return   $result . "SS";
}
}

How to check if Magento is running in production mode or developer mode

If you want to know. your Magento 2 website is running on which environment you can run below command on terminal and very easily you can kn...

Popular Posts

Posts