Sum values from selected repeater items.

Hello everyone.

So I have this repeater with item name, checkbox and price. There’s also a button SUBMIT on pressing which I want to make a total of the selected items only using the checkbox. I’m using this code which sums all the prices:

export function totals_click(event) {
let initialValue = 0;
let sum = $w(“#tea”).data.reduce(
(accumulator, currentValue) => accumulator + Number(currentValue.price), initialValue
);
$w(“#total”).text = sum.toString();
}

How do I make the sum of selected items only? Thank you.