I am trying to get customer collection based on email_id and my custom customer attributes i.e phone_code and mobile_number.

When I only add email filter getList return's customer array object but when I add my custom filter of mobile_number and phone_code attribute it return's 0 element error.

So is there any way we can use custom customer attributes in Search Criteria.

My Sample code:

$customerRepository = $this->_customerRepositoryInterface;

$email[] = $this->_filterBuilder
$phonecode[] = $this->_filterBuilder
$mobile[] = $this->_filterBuilder

$searchCriteria = $this->_searchCriteriaBuilder

$customerCollection = $customerRepository->getList($searchCriteria)->getItems();
  • what's in $row array ? Sep 27, 2017 at 14:52
  • it is just some value you can assume $row[5]="[email protected]", $row[7]="65" and $row[11]="00000110" Sep 28, 2017 at 1:19
  • Hi All, It's working fine now, it was because of my data was not correctly saved for particular customer. Thanks. Sep 28, 2017 at 2:27


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.