Need help with a price display on a store repeater

Problem solved!!

here’s the code:

$w.onReady(function () {
 $w('#dataset6').onReady(() => {
        $w('#Repeater').onItemReady(($item, itemData) => {
            let sTitle = itemData.formattedDiscountedPrice;
            if (sTitle === itemData.formattedPrice) {
                $item("#originalPrice").collapse();
            } else {
                $item("#originalPrice").expand();
            }
        })
    })

});

notes:

  • the #dataset is the dataset connected to your repeater
  • In order for this to work, you will have to have 2 texts element, one connected to the formattedDiscountedPrice field and other connected to the formattedPrice field
  • The one that you will have always on display is the text element connected with the formattedDiscountedPrice, and you will want to only display the original price if it is not equal
  • change the id of the text element connected to the formattedPrice to originalPrice and replace the #dataset and #repeater to the id’s of the dataset that you are using and the repeater that you are working on
1 Like