Please be sure that you paste your code as a “code snippet”. To do this, you can either click on the + on the left and then select “Add a code snippet”, which will create a box like this:
#code here
Or you can paste your code, highlight it and the click the button on the end of the context bar that says “code snippet”, which will convert the highlighted content into a code snippet format. You can still go back and update your original question and format that text as a code snippet.
To your question, first, have you tried using the built-in functionality in the member page? Wix already provides the “My Orders” page there and it is pretty good. Does it not meet your needs?
As far as your code, is the only code on the page? Have you tried inserting console.log(“got to here”) or console.log(results) type debugging messages and checked the console to see if you are getting to “here” (or whatever) or that you get any results?
For instance, I took part of your code and added it to one of my pages and added a console.log message to check it and I did see my message printed in the console. Here is what I tested:
wixData.query("Stores/Orders")
.find()
.then( (results) => {
let orders= results.items
if ( orders.length > 0) {
console.log("GOT TO HERE");
}
});
and got:
So, I obviously have orders. I can then build from there, adding my show() and hide() calls as appropriate. Since I took this code from your code above, we can say that this part is working fine.
