Hello,

I'm working with the 4.20 version and I've research about how to retrieve first and last names attributes.

We need to inject the following dependencies for IGenericAttributeService and IWorkContext.

Then We can retrieve the field value:

genericAttributeService.GetAttribute<Type>(customer, AttributeName);


Examples:

// Retrieving first name
var firstName = genericAttributeService.GetAttribute<string>(customer, NopCustomerDefaults.FirstNameAttribute);


Don't forget to add the following usings:

Nop.Core.Domain.Customers
Nop.Services.Common

Reagards