Error: Invalid value of UK provided for the countryId field.

Error File: vendor\\magento\\module-customer\\Model\\ResourceModel\\AddressRepository.php

Error line: 133

Code is:

$customer = $this->customerRepository->getById($customer->getId());
$cattrValue = $customer->getCustomAttribute('username');
$customer->setCustomAttribute('username', $customerData['web_username']);


$this->customerRepository->save($customer, $hashedPassword);

Country ID should be GB. But as you are not upding it the address must already be in the DB. You will have to update UK to GB via direct SQL


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.