lokesh341 commited on
Commit
6c87837
·
verified ·
1 Parent(s): c5276eb

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +7 -4
templates/menu.html CHANGED
@@ -1855,14 +1855,17 @@
1855
  return;
1856
  }
1857
 
1858
- // Calculate total items in cart
1859
- const totalItems = cart.reduce((total, item) => total + item.quantity, 0);
 
 
 
1860
 
1861
  // Update cart icon badge
1862
  const cartIcon = document.getElementById('cart-icon');
1863
  if (cartIcon) {
1864
- cartIcon.innerText = totalItems;
1865
- cartIcon.style.display = totalItems > 0 ? 'flex' : 'none';
1866
  }
1867
 
1868
  const buttonContainers = document.querySelectorAll('.button-container');
 
1855
  return;
1856
  }
1857
 
1858
+ // Calculate total quantity of items in cart
1859
+ let totalQuantity = 0;
1860
+ cart.forEach(item => {
1861
+ totalQuantity += item.quantity;
1862
+ });
1863
 
1864
  // Update cart icon badge
1865
  const cartIcon = document.getElementById('cart-icon');
1866
  if (cartIcon) {
1867
+ cartIcon.innerText = totalQuantity;
1868
+ cartIcon.style.display = totalQuantity > 0 ? 'flex' : 'none';
1869
  }
1870
 
1871
  const buttonContainers = document.querySelectorAll('.button-container');