0

Is anything missing in below code?

<?php

namespace Vendor\Customer\Plugin;

class EmailNotificationPlugin
{
   public function aroundnewAccount(
        \Magento\Customer\Model\EmailNotification $subject,        
        \Closure $proceed,        
        \Magento\Customer\Model\CustomerInterface $customer,
        $type = self::NEW_ACCOUNT_EMAIL_REGISTERED,
        $backUrl = '',
        $storeId = null,
        $sendemailStoreId = null
    ) {
        echo'return'; exit;
        return ;     
    }
}

2 Answers 2

0

Looking at the Magento Core code, this class doesn't exist \Magento\Customer\Model\CustomerInterface

You can use \Magento\Customer\Api\CustomerRepositoryInterface class instead, depends what you want to achieve.

The correct path for the class you are looking for should be: \Magento\Customer\Api\Data\CustomerInterface

Also make sure your method name to be camelCase

aroundNewAccount

Your code should look like this:


namespace Vendor\Customer\Plugin;

class EmailNotificationPlugin
{
   public function aroundNewAccount(
        \Magento\Customer\Model\EmailNotification $subject,        
        \Closure $proceed,        
        \Magento\Customer\Api\Data\CustomerInterface $customer,
        $type = self::NEW_ACCOUNT_EMAIL_REGISTERED,
        $backUrl = '',
        $storeId = null,
        $sendemailStoreId = null
    ) {
        echo'return'; exit;
        return ;     
    }
}
1
  • @devhs check this answer, might works.
    – Sohel Rana
    Commented Aug 6, 2021 at 6:21
0

Try this:

<?php

namespace Vendor\Customer\Plugin;

class EmailNotificationPlugin
{
   public function aroundNewAccount(
        \Magento\Customer\Model\EmailNotification $subject,        
        \Closure $proceed,        
        $customer,
        $type,
        $backUrl
        $storeId
        $sendemailStoreId
    ) {
        echo'return'; exit;
        return ;     
    }
}

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.