Skip to content

Commit

Permalink
Merge pull request #60 from paolofajardo/fixes2
Browse files Browse the repository at this point in the history
Se elimino funcion duplicada
  • Loading branch information
paolofajardo authored Oct 30, 2023
2 parents 5c6806f + 44b9291 commit b84d0f6
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions js/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,6 @@ function eliminarProducto(botonEliminar) {
recalcular();
}

function recalcular() {
let cantidad = document.getElementsByClassName('cantidad');
let resultado = document.getElementsByClassName('subtotal');
let precio = document.getElementsByClassName('precio');

for (let i = 0; i < precio.length; i++) {
let cantidadValue = parseFloat(cantidad[i].value);
let precioValue = parseFloat(precio[i].querySelector('.precio').innerHTML);
if (isNaN(cantidadValue)) {
cantidadValue = 1;
}
resultado[i].innerHTML = (cantidadValue * precioValue).toFixed(2);
}
}

function recalcular() {
let cantidad = document.getElementsByClassName('cantidad');
let resultado = document.getElementsByClassName('subtotal');
Expand Down

0 comments on commit b84d0f6

Please sign in to comment.