customer account sign up

I am trying to figure out how to set up so when my customers complete the first purchase they are given the option to create an account. I already have the account page set up. I don’t know how to get the page to pop up on that first sale. I don’t really understand coding.

You can re-direct them to your login page after they click your purchase button with the code below:

import wixLocation from “wix-location”;
$w.onReady( function () {
$w(‘#PurchaseButton’).onClick(() => {
wixLocation.to(’ https://enterYourLoginPageAddressHere ');

            } 
                  })