Вот ещё такое решение:
<div>
<input type="checkbox" name="price" value="170"/>
<label>250г</label>
</div>
<div>
<input type="checkbox" name="price" value="680"/>
<label>1000г</label>
</div>
<div>
<input type="checkbox" name="price" value="680"/>
<label>1000г</label>
</div>
<div>
<input type="checkbox" name="price" value="680" />
<label>1000г</label>
</div>
<hr>
<div>
<span id="result">0</span> грн.
</div>
<script>
let result = document.querySelector('#result');
function sum() {
let checks = document.querySelectorAll('input[name="price"]:checked');
let prices = [];
let summa;
if (checks.length > 0) {
checks.forEach(el => prices.push(+el.value));
summa = prices.reduce((acc, element) => acc + element);
}
else summa = 0;
result.textContent = summa;
}
document.querySelectorAll('input[name="price"]').forEach(el => el.addEventListener('input', sum));
</script>