var customer = WorkContext.CurrentCustomer;
var gender = customer.GetAttribute<string>(SystemCustomerAttributeNames.Gender);
Thanks very much Mariann - this is very useful!
Just in case you're interested, I've been using this to change the css based on user attributes (Head.cshtml grabs a different css file) e.g. if the user is male then the page is presented slightly differently. This will hopefully turn into a cool little feature where users can customise their views via their account settings (a bit like the theme selection option but more lightweight).
Anyway, thanks again!
Something similar, but as I'm "new" to nop I'm at the bottom of the learning curve. So please forgive my ignorance.
I would like to add additional customer preferences such as preferred sizes. Similar to Male/Female options, I would like to add Preferred Shoe Size: then have a drop down of sizes for the customer to select. This would be saved along with the customer data (gender, Preferred Shoe size, preferred Shirt size, etc.).
I'm not sure where to start on this?
model.Gender = _genericAttributeService.GetAttribute<string>(customer, NopCustomerDefaults.GenderAttribute);
Refer to nop4.2.0\Presentation\Nop.Web\Areas\Admin\Factories\CustomerModelFactory.cs