Wix Backend Site GeneralInfo Get Address question

Question:

How do I use getAddress to get the google formatted address into a string in the backend that I can use?

Code:

export function getAddress() {
return wixSite.generalInfo.getAddress();
}

   getAddress()

.then( (address) => {
$w(“#address”).text = address.googleFormattedAddress;
});

Product:
Using online Wix Editor

What are you trying to achieve:
I need the google formatted business address in a string or variable I can use in a function.

What have you already tried:
Checked other forum posts, googled, and documentation.

I have no issues using this to get the address into a text field. I have tried different ways to get this to a string to use in a function, but I ether get NULL or promise. I even tried putting it in the text box and then pulling it back from there and it wouldn’t work. Any help here would be appreciated.

Your → getAddress-function is a BACKEND-FUNCTION ? (probably → YES)

$w.onReady(async()=>{console.log('Page is ready...');
    const myGottenAddress = await getAddress(); 
    console.log('Address: ', myGottenAddress);
    console.log(typeof myGottenAddress);
});

Thank you for a nudge in the right direction.

For others this worked for me, I just put this in my function. I then used the bizAddress as I needed:

const bizAddress = await getAddress().then( (address) => address.googleFormattedAddress);

If it resolved your issue → mark it as solution. :wink: