Issue
What is the equivalent of this code in magento 2?
Mage::getModel('customer/customer')->loadByEmail();
Solution
Please use this code:
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customer = $objectManager->get('Magento\Customer\Model\Customer');
$customer->setWebsiteId('1');
$customer->loadByEmail('test@gmail.com');
?>
Answered By - Abhinav Kumar Singh Answer Checked By - Mildred Charles (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.