Hi Anthony,
thanks for your response. May I ask for a solution for following requirement:
I want to show in a Text Element the calculated amount of a discount in ‘%’.
Edit
I tried this:
$w.onReady(async function () {
$w('#topItems').onItemReady( ($item, itemData) => {
$item('#discountValue').text = (1-(itemData.discountedPrice / itemData.Price)*100).toString();
} );
const {items: collectionData} = await wixData.query('Stores/Products').find();
console.log(collectionData);
$w('#topItems').data = collectionData;
});
But it doesn’t work.
Am I right if I access the ‘Stores/Products’ collection to get the data?
To compute the discount in ‘%‘ as I would use the formula:
1–(discountedPrice/price))*100
that gives me the percentage of the relevant discount value.
But I’m not sure how to get that in a JS code?
Thanks!