Spaces:
Sleeping
Sleeping
Update templates/cart.html
Browse files- templates/cart.html +7 -2
templates/cart.html
CHANGED
@@ -212,10 +212,15 @@
|
|
212 |
quantityInput.value = quantity;
|
213 |
|
214 |
// Update price in UI
|
|
|
215 |
priceElement.innerText = `${data.new_item_price.toFixed(2)}`;
|
216 |
|
217 |
-
// Update subtotal
|
218 |
-
|
|
|
|
|
|
|
|
|
219 |
} else {
|
220 |
alert('Error updating quantity: ' + data.error);
|
221 |
}
|
|
|
212 |
quantityInput.value = quantity;
|
213 |
|
214 |
// Update price in UI
|
215 |
+
const priceElement = document.querySelector(`.base-price[data-item-name="${itemName}"]`);
|
216 |
priceElement.innerText = `${data.new_item_price.toFixed(2)}`;
|
217 |
|
218 |
+
// Update subtotal
|
219 |
+
document.getElementById("subtotal-text").innerText = `Subtotal: $${data.subtotal.toFixed(2)}`;
|
220 |
+
|
221 |
+
// Update total (without discount)
|
222 |
+
document.getElementById("total-text").innerText = `Total: $${data.subtotal.toFixed(2)}`;
|
223 |
+
|
224 |
} else {
|
225 |
alert('Error updating quantity: ' + data.error);
|
226 |
}
|