Simultaneously Run a query

I guess the issue is Promises, async and returns.
You can try:

import wixData from ‘wix-data’ ;
$w.onReady( function () {
wixData.query( “Billing/Invoices” ).eq( “status” , “Paid” ).find()
.then((result) => {
let res = result.items.length
return wixData.query( “Stores/Orders” ).find() // Return
.then((results) => {
let orders = results.items.length
if (res > 0 || orders > 0 ) {
$w( ‘#group1’ ).show()
$w( “#text10” ).hide()
$w( “#button1” ).hide()
} else {
$w( ‘#group1’ ).hide()
$w( “#text10” ).show()
$w( “#button1” ).show()
$w( “#text10” ).text = “To access this page, please purchase a package.” ;
}
return // Return
});
})
})

OR using closure ()

import wixData from ‘wix-data’ ;
$w.onReady( function () {
wixData.query( “Billing/Invoices” ).eq( “status” , “Paid” ).find()
.then((result) => {
// Closure
let res = result.items.length
function queryStore() {
return wixData.query( “Stores/Orders” ).find()
.then((results) => {
let orders = results.items.length
if (res > 0 || orders > 0 ) {
$w( ‘#group1’ ).show()
$w( “#text10” ).hide()
$w( “#button1” ).hide()
} else {
$w( ‘#group1’ ).hide()
$w( “#text10” ).show()
$w( “#button1” ).show()
$w( “#text10” ).text = “To access this page, please purchase a package.” ;
}
});
}
queryStore() // for anonymous function you can to use (function() {})()
//Closure
})
})

wixData.query is a promise.