Spaces:
Sleeping
Sleeping
Update templates/cart.html
Browse files- templates/cart.html +4 -0
templates/cart.html
CHANGED
@@ -203,6 +203,10 @@
|
|
203 |
.then(response => response.json())
|
204 |
.then(data => {
|
205 |
if (data.success) {
|
|
|
|
|
|
|
|
|
206 |
document.querySelector(`input[data-item-name="${itemName}"]`).value = quantity;
|
207 |
} else {
|
208 |
alert("Error updating quantity: " + data.error);
|
|
|
203 |
.then(response => response.json())
|
204 |
.then(data => {
|
205 |
if (data.success) {
|
206 |
+
quantityInput.value = quantity;
|
207 |
+
let itemPriceElement = document.querySelector(`.item-price[data-item-name="${itemName}"]`);
|
208 |
+
let subtotalElement = document.querySelector('#subtotal');
|
209 |
+
subtotalElement.innerText = `$${data.subtotal.toFixed(2)}`;
|
210 |
document.querySelector(`input[data-item-name="${itemName}"]`).value = quantity;
|
211 |
} else {
|
212 |
alert("Error updating quantity: " + data.error);
|