i just want to change some request params by using beforeExecute plugin so can i do same.... ?

etc/di.xml **

<type name="Magento\Customer\Controller\Account\CreatePassword">
    <plugin name="create_password_bug_fixed" type="Vendor\Base\Plugin\Account\CreatePassword" sortOrder="1"  />


CreatePassword.php(Plugin Class)

    namespace Vendor\Base\Plugin\Account;

class CreatePassword{
    public function beforeExecute(\Magento\Customer\Controller\Account\CreatePassword $subject){
        /*What need to write here for change attribute value like Token and id */



2 Answers 2


Try the following way:

$subject->getRequest()->setParam('existing_key', $newValue);

complete code for post values:-

create befure plugin of your funtion in which receiving form post.

public function beforeExecute(
        \Vendor\Moduled\Controller\Path\Path\Save $subject
    ) {
        $date = $subject->getRequest()->getPostValue('expired_at') != "" ? $subject->getRequest()->getPostValue('expired_at')  : 'Dec 31, 2050';
        $subject->getRequest()->setPostValue('expired_at', $date);

        return [$subject];

In above example I am checking if expired_at is empty change it to Dec 31, 2050

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.