Can any one help me to override the customer registration api and restrict the @163.com emails while registering magento2 rest api

Help me great.


1 Answer 1


You can create a before plugin for function \Magento\Customer\Model\AccountManagement::createAccount and get the email address from the $customer object then do the domain validation if the validation fails throw some exception.

ref: https://devdocs.magento.com/guides/v2.4/extension-dev-guide/plugins.html to create a plugin

  • Thanks for your reply sundaram we would like to do it from rest api
    – dev456
    Aug 18, 2021 at 8:39
  • Can you suggest me any overriding process of default rest api to the customer creation
    – dev456
    Aug 18, 2021 at 8:40
  • @VijayKumar Magento has multiple overriding concepts, in that plugin is of the overriding concept. Kindly refer to the above link to get an understanding of that. Also I have mentioned the class and function to write the plugin for. Aug 18, 2021 at 17:33
  • Thanks sundaram I will check it and let you know
    – dev456
    Aug 19, 2021 at 6:15
  • Hi @Meenakshisundaram Is that concept works for rest api overriding process
    – dev456
    Aug 20, 2021 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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