The code below returns results when testing, but doesn’t return anything on the publish site. Can someone help?
export function populatePrices() {
let priceArray = {};
wixData.query("Prices")
.ascending("priceTier")
.descending("price")
.find()
.then((results) => {
console.log(results.totalCount);
if (results.totalCount > 0) {
let items = results.items;
for ( var p = 0; p < results.totalCount; p++) {
priceArray[p] = { “itemPrice”: items[p].price, “tier”: items[p].priceTier };
}
console.log(currentPrices);
} **else** {
console.log("No Prices");
}
})
. **catch** ((err) => {
console.log(err);
});
return priceArray;
}