You need to prepare your HTML before doing the calculation.
Add a class to those who will participate in the summation
Add a value for the inputs containing the value it represents in the final account
Add a class to what it will receive the total.
After this is done, you can use Jquery, as I saw it already using, to go through all the inputs of the defined class and, if it is selected, add to the final account.
$(document).ready(function() {
calcTotal();
$('.price-variant').change(function() {
calcTotal();
});
});
function calcTotal() {
var total = 0;
$('.price-variant').each(function() {
var isChecked = $(this).is(':checked');
if(!!isChecked) {
total += Number($(this).val());
}
});
$('.total').text('R$ ' + total.toFixed(2));
}
I made a Plunk with the code working for you to see (I took it and put the code of the component below, where you add and remove some "additional")
link
I hope it solves!