Question:
How can I display the price of a variant displayed within a repeater? Product:
Wix Editor What are you trying to achieve:
I am trying to display the price of a variant when displaying the filtered item in a repeater.
What have you already tried:
I have tired various googling methods and even attempted to put it in chat gpt even though it may be outdated. I have not gotten anything to work thus far.
Additional information:
I am fairly new to Wix coding but understand the basics of it. I know it might be a complicated request.
I want to get it to show the variant price where $$$$ is. I can only get the base price of the item to show in that place. I would also like to eventually get another text element to show the +/- difference between the selection and other options.
You need code for this. You can’t do math with CMS.
//Pass the selected product data to a variable
let selectedProduct.
$w("#productsRepeaterId").onItemReady(($item, itemData, index) => {
//rest of the code for other parts of the repater
$item("#price").text = `Difference: ${selectedProduct.price - itemData.price} Price: ${itemData.price}`;
});
This is the idea of how you can show the difference of the prices between selectedProduct and current variant.
I do not where to put that code. I think that is for a future idea with a difference display. I appreciate the forethought but not to be rude, I am currently not worried about that. I am trying to figure out how to get #price within the items of the repeater to show the variant price.
This is the code i have so far for these 3 repeaters. The filters work but as I said above, i am in need to display the price on the items.