Help putting code into async and wait...

Hey Dan,

Understand that we are unable to debug or rewrite complex code and page configurations. You have over 4200 lines of code - that’s a lot to figure out.

You should move the import statements to the top of the code file. Also, move the onReady() function to the top of the code as a best practice.

You have a number of lines of code that are flagged as errors. The error message indicates that you need to convert those values to Numbers in order to perform a calculation.

You received a fairly comprehensive and complete answer from Alex. The main issue that you have is that you are performing I don’t know how many queries one after the next without properly handling the Promises returned by the queries.

You will need to redesign and reorganize your site’s code. You might want to consider hiring a Velo expert to help you with your site development.