Custom fields are not recognized by the code

Question:
Hi, I am using a code that retrieves data from member info specifically from a custom field
“wallet”

however it only recognize default fields like first name, last name etc… and when I replace my data - that is in the custom field - with last name it works (lastName)

import wixData from 'wix-data';
import wixUsers from 'wix-users';

$w.onReady(async function () {
  const user = wixUsers.currentUser;
  console.log("User logged in status:", user.loggedIn);
  if (user.loggedIn) {
    try {
      const memberData = await wixData.get("Members/PrivateMembersData", user.id);
      console.log("Full member data:", memberData);
      console.log("Wallet:", memberData.contactDetails?.customFields?.wallet);
    } catch (err) {
      console.error("Error fetching member data:", err);
    }
  } else {
    console.log("No user logged in");
  }
});

I use this code to see this output

User logged in status: true

Full member data:

{...}

jsonTableCopy JSON

name:

"X X"

lastLogin:

"Wed Mar 12 2025 21:16:28 GMT+0300 (GMT+03:00)"

loginEmail:

"x@gmail.com"

_id:

"ID"

_createdDate:

"Thu Apr 04 2024 00:59:24 GMT+0300 (GMT+03:00)"

_updatedDate:

"Thu Apr 04 2024 00:59:24 GMT+0300 (GMT+03:00)"

slug:

"X"

phones:

[...]

lastName:

"X"

firstName:

"alper"

mainPhone:

"null"

language:

"en"

status:

"ACTIVE"

picture:

"https://l"

nickname:

"x x "
**Wallet: undefined**

as you see wallet field is undefined.
but if I use lastName as wallet its there and codes are working with that field.

Can you tell me how can I create a custom field that works like default fields?

Product:
Wix Studio

What are you trying to achieve:

What have you already tried:

Additional information:

Hi, @alperoz49 !!

Personally, I think it’s better not to add custom fields to the Members/PrivateMembersData collection. :thinking: Instead, you could create a separate collection, define a wallet field there, and link it to the Members/PrivateMembersData data using a reference field. :grin:

1 Like

Also worth noting that wix-users is deprecated, so worth transitioning to wix-members-frontend or wix-members-backend depending on the use case.

Also worth noting we’re beginning to transition to SDK (Velo will continue to function, so no need to move if you don’t want to) - Get Current Member | SDK - for the most part, the code remains the same, but imports and a few smaller syntaxes here and there would change.