Code issues on the WIX mobileversion

Hi everyone, I need some help with a Wix/Velo issue.

We built our site with Velo on Wix. Wix has its own built-in registration form that you basically can’t customize, so we added custom code to make the “Register” button redirect to an external payment website.

On desktop everything works fine — the external link opens immediately.
But on mobile, instead of opening the link, it just sends the user back to the home page. Sometimes it works, but like 2 out of 10 times, and only after a 10+ second delay.

Wix support told us to “set different settings for desktop and mobile,” but Wix doesn’t actually allow that, so they had no real solution.

I’ve attached a screenshot of the code.
Has anyone run into this? Any ideas on how to fix it?

Thanks!

It’s possible to setup a member custom registration form and similarly sign-in form with code - Creating a Custom Registration Form with Code

I also noticed you’re using wixUsers which was deprecated a few years back and can’t be guaranteed to work as intended. At the ver least, I’d recommend using wix-members-frontend - On Login | Velo

What’s the intended behaviour? For users to make a payment upon becoming a member? If so, the current code will direct them to make payment every time they log into their account - which I imagine isn’t the expected flow

There’s a buy button on the website. To buy, you must first register. After registration, the user is automatically redirected to the “third-party” payment page. After successful payment, the “third-party page” redirects the user to their personal account, where they are granted access. We sell an online course.