Wix location with custom registration form

You’re correct, you need a Promise. And in fact, you have one. The .then() is for the fulfillment of the Promise.

You should move the .then() to the end of the .register() function.

You currently have this:

"state": ($w('#state').value)

.then(()=>{
     wixLocation.to('/account/my-account'); 
  } 

}); 

And, if my eyes aren’t deceiving me, you should have this instead:

"state": ($w('#state').value)

})
.then(()=>{
     wixLocation.to('/account/my-account'); 
} ;

I hope this helps,

Yisrael