This question already has an answer here:
I have added few custom attributes and one of them is
is_mobile_verified while registering I dont set any value for this however, while creating the attribute I set default value as 0.
now after registration, I am trying to get the value to do some other functionalities. I am facing issues at this point.
$customer_id = 39; // SETTING SOME ID FOR TESTING PURPOSE $is_verified = $customer->getCustomAttribute('is_mobile_verified')->getValue();
If I get the value using this code I am getting error message as below
Fatal error: Uncaught Error: Call to a member function getValue() on null in C:\xampp\htdocs\
Because there is no value updated to this fields so for. Once from the admin section if I updated as
0 Then it returns the value.
Is there a way to restrict this behavior as in the earlier scenario also, if there is no value exist I can get empty value. Apparently this is what the actual behavior in