Hi guys,
Sadly I wrote a page that’s been launch for a few months that did a query against the “Marketing/Coupons” internal collection for my custom booking page. The sad part? I didn’t realize that this collection is “Admin” only read. This meant that it work great for me (an admin), but I didn’t realize that for any of my user this didn’t work because they don’t have the permissions to read this collection.
Normally I would change this collections permissions, but the “Marketing/Coupons” collection is locked as “Admin” read only and can not be change.
With this in mind, how can I read this data and return it to my booking page? I need it to provide discounts on my booking page. Is there a back-end function that would allow me to get this data and return in to my client side.
Here is what I was doing:
async function getAllCoupons() {
const data = await wixData.query("Marketing/Coupons").find();
return data.items;
}
...{other function}
allcoupons = await getAllCoupons();
allcoupons.forEach(couponitem => couponsMap[couponitem.code] = couponitem);
Thank you.
David