I added custom fields to my members via the wix dashboard, but they’re not loading with the API.
I have several custom fields that I added in the dashboard:
“Subscribed To Announcements”, “Subscribed to Newsletter”.
Since wix doesn’t allow boolean custom fields, I’m creating my own UI with checkboxes to update these custom member fields.
When I try to load the fields with this code, the customFields object is just empty.
let response = await members.getCurrentMember({fieldsets: ['FULL']});
console.log(Object.keys(response.member.contact.customFields));
console.log("----");
console.log(response.member.contact);
Result:
[]
----
{
"contactId": "redacted",
"firstName": "redacted",
"lastName": "redacted",
"phones": [],
"emails": [
"redacted"
],
"addresses": [],
"customFields": {}
}
How do I access my custom fields?
Product:
Wix Editor
What are you trying to achieve:
I am trying to access and update my member’s custom fields with code.
What have you already tried:
I’ve looked at some forum posts, but none of them have this issue. Other user’s custom fields are returned in the javascript object.
I have tried using the wix-members-frontend
and wix-members.v2
libraries to access the current user, I can’t load the custom fields.