i need to get customer id before login by custom attribute value in magento 2.1.5 for login by usename $this->customerRepository->get($username);


Please Try below code :

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $customerObj = $objectManager->create('Magento\Customer\Model\ResourceModel\Customer\Collection');
    $collection = $customerObj->addAttributeToSelect('*')

| improve this answer | |
  • @Bapu I have updated my answer please check. – Deexit Sanghani May 1 '17 at 9:13
  • Thanx deexit & manthan too – Birjitsinh Zala May 1 '17 at 9:36
  • Before login it secure or not? – Birjitsinh Zala May 1 '17 at 9:37
  • How we can get customer attribute collection in magento 2? Because i want to show on catalog price rule form. How i can achieve this? – Pramod Kharade Aug 3 '17 at 7:03

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.