Hi,
I added custom input in registration form (override template is ok) and I want to add a custom check on this input (call API to get an ID...).
I want override Magento\Customer\Controller\Account\CreatePost but it's don't work.
I added di.xml in MyNameSpace/MyModuleName/etc and a custom CreatePost.php in MyNameSpace/MyModuleName/Controller/Action
Any idea??? I've follow this tutorial -> https://www.magestore.com/magento-2-tutorial/magento-2-controller-override-tutorial/
I founded that -> https://community.magento.com/t5/Magento-2-x-Programming/Overriding-a-controller-in-Magento-2/td-p/6...
and it's seems to be same code...
Please use 'plugin' instead of 'preference' as it's been used in this:
Hi @JoouulDev
I found that https://webkul.com/blog/overriding-rewriting-classes-magento2/
kindly check this link and follow these steps
------------
If you've found one of my answers useful, please give"Kudos" or "Accept as Solution"
@syedhasan I did the same thing but don't work
Hi @JoouulDev
Now you can follow these steps to override to customer CreatePost file.
Step 1.
create two files in a etc folder 1) di.xml 2) module.xml
MyNameSpace/MyModuleName/etc/di.xml
MyNameSpace/MyModuleName/etc/module.xml
Step 2.
create file registration.php in MyNameSpace/MyModuleName/
MyNameSpace/MyModuleName/registration.php
Step 3.
create controller folder like this
MyNameSpace/MyModuleName/Controller/Account/CreatePost.php
after add these files now you run command
i) php -dmemory_limit=1024M bin/magento setup:upgrade
ii) php bin/magento cache:clean
iii) sudo chmod -R 0777 pub/ var/
------------------------------------------------
If you've found one of my answers useful, please give"Kudos" or "Accept as Solution"