Step 59 build a shopping cart not passing

hi, using a screen reader jaws 2026. using windows 11 pro. using google chrome, up to step 59 and it is not liking the reset the text content of the items to 0. have put them from a “0” to 0. but fcc is extremely picky. so, is it my code, logic, a dom timing issue, or something stupid i am doing. not able to see if theres any hidden characters or hidden trailing spaces as totally blind and rely on speech. so will paste my html, and js and the error and the link to the step. maybe ray can help me out. found him kind and curteous. and so heres my code. can any one help me out, so close to finishing this project, but fcc testing system could be more screen reader friendly. and you could have more plain english messages, isntead of vague message. could make the testing system a whole lot better for lbind developers. did suggest some options a while back, but they were ignored either by quincy him self or the mods. so wont suggest any more accessibility improvements as you dont listen to blind people or blind developers. defintely rant over. pasting below.

html:

<!DOCTYPE html>

<html lang="en">

  <head>

    <meta charset="UTF-8" />

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>freeCodeCamp Shopping Cart</title>

    <link rel="stylesheet" href="./styles.css" />

  </head>

  <body>

    <header>

      <h1 class="title">Desserts Page</h1>

    </header>

    <main>

      <button id="cart-btn" type="button" class="btn">

        <span id="show-hide-cart">Show</span> Cart

      </button>

      <div id="cart-container">

        <button class="btn" id="clear-cart-btn">Clear Cart</button>

        <div id="products-container"></div>

        <p>Total number of items: <span id="total-items">0</span></p>

        <p>Subtotal: <span id="subtotal">$0</span></p>

        <p>Taxes: <span id="taxes">$0</span></p>

        <p>Total: <span id="total">$0</span></p>

      </div>

      <div id="dessert-card-container"></div>

    </main>

    <script src="./script.js"></script>

  </body>

</html>

java script:

// -----------------------------
// DOM Elements
// -----------------------------
const cartContainer = document.getElementById("cart-container");
const productsContainer = document.getElementById("products-container");
const dessertCards = document.getElementById("dessert-card-container");
const cartBtn = document.getElementById("cart-btn");
const clearCartBtn = document.getElementById("clear-cart-btn");
const totalNumberOfItems = document.getElementById("total-items");
const cartSubTotal = document.getElementById("subtotal");
const cartTaxes = document.getElementById("taxes");
const cartTotal = document.getElementById("total");
const showHideCartSpan = document.getElementById("show-hide-cart");

let isCartShowing = false;
totalNumberOfItems.textContent = 0; // ✅ Important for FCC

// -----------------------------
// Products Array
// -----------------------------
const products = [
  { id: 1, name: "Vanilla Cupcakes (6 Pack)", price: 12.99 },
  { id: 2, name: "French Macaron", price: 3.99 },
  { id: 3, name: "Pumpkin Cupcake", price: 3.99 },
  { id: 4, name: "Chocolate Cupcake", price: 5.99 },
  { id: 5, name: "Chocolate Pretzels (4 Pack)", price: 10.99 },
  { id: 6, name: "Strawberry Ice Cream", price: 2.99 },
  { id: 7, name: "Chocolate Macarons (4 Pack)", price: 9.99 },
  { id: 8, name: "Strawberry Pretzel", price: 4.99 },
  { id: 9, name: "Butter Pecan Ice Cream", price: 2.99 },
  { id: 10, name: "Rocky Road Ice Cream", price: 2.99 },
  { id: 11, name: "Vanilla Macarons (5 Pack)", price: 11.99 },
  { id: 12, name: "Lemon Cupcakes (4 Pack)", price: 12.99 },
];

// -----------------------------
// Render Product Cards
// -----------------------------
products.forEach(p => {
  dessertCards.innerHTML += `
    <div class="dessert-card">
      <h2>${p.name}</h2>
      <p class="dessert-price">$${p.price}</p>
      <button id="${p.id}" class="btn add-to-cart-btn">Add to cart</button>
    </div>
  `;
});

// -----------------------------
// Shopping Cart Class
// -----------------------------
class ShoppingCart {
  constructor() {
    this.items = [];
    this.taxRate = 8.25; // percent
  }

  addItem(id) {
    const product = products.find(p => p.id === id);
    this.items.push(product);

    this.renderCart();
    totalNumberOfItems.textContent = this.items.length; // ✅ important
    this.updateTotals();
  }

  renderCart() {
    productsContainer.innerHTML = "";
    const counts = {};

    this.items.forEach(item => {
      counts[item.id] = (counts[item.id] || 0) + 1;
    });

    Object.keys(counts).forEach(pid => {
      const product = products.find(p => p.id === Number(pid));
      productsContainer.innerHTML += `
        <div class="product">
          <p>${counts[pid]}x ${product.name}</p>
          <p>$${product.price}</p>
        </div>
      `;
    });
  }

  clearCart() {
    this.items = [];
    productsContainer.innerHTML = "";
    totalNumberOfItems.textContent = 0; // ✅ FCC requires number 0
    cartSubTotal.textContent = "$0.00";
    cartTaxes.textContent = "$0.00";
    cartTotal.textContent = "$0.00";
  }

  updateTotals() {
    const subtotal = this.items.reduce((sum, item) => sum + item.price, 0);
    const tax = +(subtotal * (this.taxRate / 100)).toFixed(2);
    cartSubTotal.textContent = `$${subtotal.toFixed(2)}`;
    cartTaxes.textContent = `$${tax.toFixed(2)}`;
    cartTotal.textContent = `$${(subtotal + tax).toFixed(2)}`;
  }
}

// -----------------------------
// Instantiate Cart
// -----------------------------
const cart = new ShoppingCart();

// -----------------------------
// Event Listeners
// -----------------------------
[...document.getElementsByClassName("add-to-cart-btn")].forEach(btn => {
  btn.addEventListener("click", e => cart.addItem(Number(e.target.id)));
});

cartBtn.addEventListener("click", () => {
  isCartShowing = !isCartShowing;
  showHideCartSpan.textContent = isCartShowing ? "Hide" : "Show";
  cartContainer.style.display = isCartShowing ? "block" : "none";
});

clearCartBtn.addEventListener("click", () => cart.clearCart());

error:
You should set the textContent of the totalNumberOfItems element to 0 .
link to the step:

:

1 Like

Hi @BlindVisionMan

The clearCart function was modified.

The first ifcondition is missing.

Please reset the step.

Happy coding

Please format your code when posting.

Please use the starting code the step gives you.

I looked back and somewhere between a half dozen and a dozen people have given you this advice, including Ray.

You absolutely must start with the code that the step gives you. It can make it impossible to pass some steps if you do not use the starting code that you are given.

It is really important that you start following this advice that multiple forum users have given you many times.

hi, reset the step, rewrote the code, did multiple resets, multiple refreshes, and a screen reader user, so fcc is just very picky at this step. so tell me how to pass htis step. totally frustrated and a screen reader user. and using jaws, so wondering, fcc dom timing, fcc broken, my code, or logic not correct? frustrated! so will paste my html and javas cript below and the error. so how to get this step to pass. and if any hidden characters or hidden trialling spaces or stray characters which my screen readers cannot read. so help me out. how to get htis to pass. please help me out asap.
marvin.
ps: pasting my html and java script and the error below.

html:

<!DOCTYPE html>

<html lang="en">

<head>

  <meta charset="UTF-8" />

  <meta http-equiv="X-UA-Compatible" content="IE=edge" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />

  <title>freeCodeCamp Shopping Cart</title>

  <link rel="stylesheet" href="./styles.css" />

</head>

<body>

  <header>

    <h1 class="title">Desserts Page</h1>

  </header>



  <main>

    <!-- Cart Toggle Button -->

    <button id="cart-btn" type="button" class="btn">

      <span id="show-hide-cart">Show</span> Cart

    </button>



    <!-- Shopping Cart Container (Initially Hidden) -->

    <div id="cart-container" style="display: none;">

      <button id="clear-cart-btn" class="btn">Clear Cart</button>



      <div id="products-container"></div>



      <p>Total number of items: <span id="total-items">0</span></p>

      <p>Subtotal: <span id="subtotal">$0.00</span></p>

      <p>Taxes: <span id="taxes">$0.00</span></p>

      <p>Total: <span id="total">$0.00</span></p>

    </div>



    <!-- Dessert Cards will be rendered here -->

    <div id="dessert-card-container"></div>

  </main>



  <script src="./script.js"></script>

</body>

</html>
java script:// DOM Elements
const cartContainer = document.getElementById("cart-container");
const productsContainer = document.getElementById("products-container");
const dessertCards = document.getElementById("dessert-card-container");
const cartBtn = document.getElementById("cart-btn");
const clearCartBtn = document.getElementById("clear-cart-btn");
const totalNumberOfItems = document.getElementById("total-items");
const cartSubTotal = document.getElementById("subtotal");
const cartTaxes = document.getElementById("taxes");
const cartTotal = document.getElementById("total");
const showHideCartSpan = document.getElementById("show-hide-cart");
let isCartShowing = false;

// Products Array
const products = [
  { id: 1, name: "Vanilla Cupcakes (6 Pack)", price: 12.99, category: "Cupcake" },
  { id: 2, name: "French Macaron", price: 3.99, category: "Macaron" },
  { id: 3, name: "Pumpkin Cupcake", price: 3.99, category: "Cupcake" },
  { id: 4, name: "Chocolate Cupcake", price: 5.99, category: "Cupcake" },
  { id: 5, name: "Chocolate Pretzels (4 Pack)", price: 10.99, category: "Pretzel" },
  { id: 6, name: "Strawberry Ice Cream", price: 2.99, category: "Ice Cream" },
  { id: 7, name: "Chocolate Macarons (4 Pack)", price: 9.99, category: "Macaron" },
  { id: 8, name: "Strawberry Pretzel", price: 4.99, category: "Pretzel" },
  { id: 9, name: "Butter Pecan Ice Cream", price: 2.99, category: "Ice Cream" },
  { id: 10, name: "Rocky Road Ice Cream", price: 2.99, category: "Ice Cream" },
  { id: 11, name: "Vanilla Macarons (5 Pack)", price: 11.99, category: "Macaron" },
  { id: 12, name: "Lemon Cupcakes (4 Pack)", price: 12.99, category: "Cupcake" }
];

// Render Dessert Cards
products.forEach(({ id, name, price, category }) => {
  dessertCards.innerHTML += `
    <div class="dessert-card">
      <h2>${name}</h2>
      <p class="dessert-price">$${price.toFixed(2)}</p>
      <p class="product-category">Category: ${category}</p>
      <button id="${id}" class="btn add-to-cart-btn">Add to cart</button>
    </div>
  `;
});

// Shopping Cart Class
class ShoppingCart {
  constructor() {
    this.items = [];
    this.taxRate = 8.25;
  }

  addItem(id) {
    const product = products.find(p => p.id === id);
    if (!product) return;

    this.items.push(product);

    // Count of this product in cart
    const count = this.items.filter(i => i.id === id).length;
    const span = document.getElementById(`product-count-for-id${id}`);

    if (span) {
      span.textContent = `${count}x `;
    } else {
      productsContainer.innerHTML += `
        <div id="dessert${id}" class="product">
          <p><span class="product-count" id="product-count-for-id${id}">1x </span>${product.name}</p>
          <p>$${product.price.toFixed(2)}</p>
        </div>
      `;
    }

    this.updateDisplay();
  }

  getCounts() {
    return this.items.length;
  }

  calculateSubtotal() {
    return this.items.reduce((sum, i) => sum + i.price, 0);
  }

  calculateTaxes(subtotal) {
    return parseFloat(((subtotal * this.taxRate) / 100).toFixed(2));
  }

  calculateTotal() {
    const subtotal = this.calculateSubtotal();
    const taxes = this.calculateTaxes(subtotal);
    const total = subtotal + taxes;

    cartSubTotal.textContent = `$${subtotal.toFixed(2)}`;
    cartTaxes.textContent = `$${taxes.toFixed(2)}`;
    cartTotal.textContent = `$${total.toFixed(2)}`;
  }

  clear() {
    this.items = [];
    productsContainer.innerHTML = '';
    totalNumberOfItems.textContent = 0; // ✅ must be number
    cartSubTotal.textContent = '$0.00';
    cartTaxes.textContent = '$0.00';
    cartTotal.textContent = '$0.00';
  }

  updateDisplay() {
    totalNumberOfItems.textContent = this.getCounts();
    this.calculateTotal();
  }
}

// Initialize cart
const cart = new ShoppingCart();

// Global function required by FCC Step 59
function clearCart() {
  cart.clear();
}

// Add to cart button listeners
[...document.getElementsByClassName("add-to-cart-btn")].forEach(btn => {
  btn.addEventListener("click", e => cart.addItem(Number(e.target.id)));
});

// Clear cart button listener
clearCartBtn.addEventListener("click", clearCart);

// Toggle cart display
cartBtn.addEventListener("click", () => {
  isCartShowing = !isCartShowing;
  showHideCartSpan.textContent = isCartShowing ? "Hide" : "Show";
  cartContainer.style.display = isCartShowing ? "block" : "none";
});

error:
You should set the textContent of the totalNumberOfItems element to 0 .
ps:: i do have the textContent set to a number and not a string, unless something i am missing.

you are still missing all the content of the clearCart method, you have a clear method instead that seems to be trying to do the same thing but is not used

You are still using the wrong starting code.

hi, okay totally blind, using a screen reader. have reset the lesson, have refreshed the page multiple times, have rewritten the code multiple times, but step 59 is not passing, been trying to wrestle with the fcc for over 24 hours or close to 36 hours, i cannot see, so dont know if any stray characters in my code. as jaws does not see it, also hdiden characters,hidden trialling spaces. so i will paste my html and javascript code below andn the errro. so i need urgent and immediate help to get this to pass. so tell me how to get this to pass, totally frustrated and tried everything, did research via google and looked at a code sample, almost same or similar code, can any one help me out? and dont want to wait around for hours, would like to get this project completed today if possible. i know i am one blind developer student, trying to learn the best way and this project taking me 3 weeks, because of accessibility barriers and the fcc not being screen reader friendly and also cryptic messages and then having to gues at each step, and only 1 more step to go once get this step passed, then the project completed. so need your help asap yesterday.
thank you.
marvin.
ps: pasting my code below. and also trying to format it correct as a screen reader user and the forum is not the most screen reader friendly interface. go figure.

ps::: pasting below.

html:

<!DOCTYPE html>

<html lang="en">

  <head>

    <meta charset="UTF-8" />

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>freeCodeCamp Shopping Cart</title>

    <link rel="stylesheet" href="./styles.css" />

  </head>

  <body>

    <header>

      <h1 class="title">Desserts Page</h1>

    </header>

    <main>

      <button id="cart-btn" type="button" class="btn">

        <span id="show-hide-cart">Show</span> Cart

      </button>

      <div id="cart-container">

        <button class="btn" id="clear-cart-btn">Clear Cart</button>

        <div id="products-container"></div>

        <p>Total number of items: <span id="total-items">0</span></p>

        <p>Subtotal: <span id="subtotal">$0</span></p>

        <p>Taxes: <span id="taxes">$0</span></p>

        <p>Total: <span id="total">$0</span></p>

      </div>

      <div id="dessert-card-container"></div>

    </main>

    <script src="./script.js"></script>

  </body>

</html>

javascript:

// -----------------------------
// DOM Elements
// -----------------------------
const cartContainer = document.getElementById("cart-container");
const productsContainer = document.getElementById("products-container");
const dessertCards = document.getElementById("dessert-card-container");
const cartBtn = document.getElementById("cart-btn");
const clearCartBtn = document.getElementById("clear-cart-btn");
const totalNumberOfItems = document.getElementById("total-items");
totalNumberOfItems.textContent = 0;  // ✅ Top-level for FCC test
const cartSubTotal = document.getElementById("subtotal");
const cartTaxes = document.getElementById("taxes");
const cartTotal = document.getElementById("total");
const showHideCartSpan = document.getElementById("show-hide-cart");

let isCartShowing = false;

// -----------------------------
// Products Array
// -----------------------------
const products = [
  { id: 1, name: "Vanilla Cupcakes (6 Pack)", price: 12.99 },
  { id: 2, name: "French Macaron", price: 3.99 },
  { id: 3, name: "Pumpkin Cupcake", price: 3.99 },
  { id: 4, name: "Chocolate Cupcake", price: 5.99 },
  { id: 5, name: "Chocolate Pretzels (4 Pack)", price: 10.99 },
  { id: 6, name: "Strawberry Ice Cream", price: 2.99 },
  { id: 7, name: "Chocolate Macarons (4 Pack)", price: 9.99 },
  { id: 8, name: "Strawberry Pretzel", price: 4.99 },
  { id: 9, name: "Butter Pecan Ice Cream", price: 2.99 },
  { id: 10, name: "Rocky Road Ice Cream", price: 2.99 },
  { id: 11, name: "Vanilla Macarons (5 Pack)", price: 11.99 },
  { id: 12, name: "Lemon Cupcakes (4 Pack)", price: 12.99 },
];

// -----------------------------
// Render Product Cards
// -----------------------------
products.forEach(product => {
  dessertCards.innerHTML += `
    <div class="dessert-card">
      <h2>${product.name}</h2>
      <p class="dessert-price">$${product.price.toFixed(2)}</p>
      <button id="${product.id}" class="btn add-to-cart-btn">Add to cart</button>
    </div>
  `;
});

// -----------------------------
// Shopping Cart Class
// -----------------------------
class ShoppingCart {
  constructor() {
    this.items = [];
    this.taxRate = 8.25; // percent
  }

  addItem(id) {
    const product = products.find(p => p.id === id);
    if (!product) return;
    this.items.push(product);
    this.renderCart();
    totalNumberOfItems.textContent = this.items.length;
    this.updateTotals();
  }

  renderCart() {
    productsContainer.innerHTML = "";
    const counts = {};
    this.items.forEach(item => {
      counts[item.id] = (counts[item.id] || 0) + 1;
    });

    Object.keys(counts).forEach(pid => {
      const product = products.find(p => p.id === Number(pid));
      productsContainer.innerHTML += `
        <div class="product">
          <p>${counts[pid]}x ${product.name}</p>
          <p>$${product.price.toFixed(2)}</p>
        </div>
      `;
    });
  }

  updateTotals() {
    const subtotal = this.items.reduce((sum, item) => sum + item.price, 0);
    const tax = +(subtotal * (this.taxRate / 100)).toFixed(2);

    cartSubTotal.textContent = `$${subtotal.toFixed(2)}`;
    cartTaxes.textContent = `$${tax.toFixed(2)}`;
    cartTotal.textContent = `$${(subtotal + tax).toFixed(2)}`;
  }

  clearCart() {
    this.items = [];
    this.renderCart();
    this.updateTotals();
    totalNumberOfItems.textContent = 0;
  }
}

// -----------------------------
// Instantiate Cart
// -----------------------------
const cart = new ShoppingCart();

// -----------------------------
// Event Listeners
// -----------------------------
[...document.getElementsByClassName("add-to-cart-btn")].forEach(btn => {
  btn.addEventListener("click", e => cart.addItem(Number(e.target.id)));
});

cartBtn.addEventListener("click", () => {
  isCartShowing = !isCartShowing;
  showHideCartSpan.textContent = isCartShowing ? "Hide" : "Show";
  cartContainer.style.display = isCartShowing ? "block" : "none";
});

clearCartBtn.addEventListener("click", () => cart.clearCart());

Error:
You should set the textContent of the totalNumberOfItems element to 0 .

You are still not using the starting code that the step gives you.

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

This is the starting code that the step gives you. You need to use it

const cartContainer = document.getElementById("cart-container");
const productsContainer = document.getElementById("products-container");
const dessertCards = document.getElementById("dessert-card-container");
const cartBtn = document.getElementById("cart-btn");
const clearCartBtn = document.getElementById("clear-cart-btn");
const totalNumberOfItems = document.getElementById("total-items");
const cartSubTotal = document.getElementById("subtotal");
const cartTaxes = document.getElementById("taxes");
const cartTotal = document.getElementById("total");
const showHideCartSpan = document.getElementById("show-hide-cart");
let isCartShowing = false;

const products = [
  {
    id: 1,
    name: "Vanilla Cupcakes (6 Pack)",
    price: 12.99,
    category: "Cupcake",
  },
  {
    id: 2,
    name: "French Macaron",
    price: 3.99,
    category: "Macaron",
  },
  {
    id: 3,
    name: "Pumpkin Cupcake",
    price: 3.99,
    category: "Cupcake",
  },
  {
    id: 4,
    name: "Chocolate Cupcake",
    price: 5.99,
    category: "Cupcake",
  },
  {
    id: 5,
    name: "Chocolate Pretzels (4 Pack)",
    price: 10.99,
    category: "Pretzel",
  },
  {
    id: 6,
    name: "Strawberry Ice Cream",
    price: 2.99,
    category: "Ice Cream",
  },
  {
    id: 7,
    name: "Chocolate Macarons (4 Pack)",
    price: 9.99,
    category: "Macaron",
  },
  {
    id: 8,
    name: "Strawberry Pretzel",
    price: 4.99,
    category: "Pretzel",
  },
  {
    id: 9,
    name: "Butter Pecan Ice Cream",
    price: 2.99,
    category: "Ice Cream",
  },
  {
    id: 10,
    name: "Rocky Road Ice Cream",
    price: 2.99,
    category: "Ice Cream",
  },
  {
    id: 11,
    name: "Vanilla Macarons (5 Pack)",
    price: 11.99,
    category: "Macaron",
  },
  {
    id: 12,
    name: "Lemon Cupcakes (4 Pack)",
    price: 12.99,
    category: "Cupcake",
  },
];

products.forEach(
  ({ name, id, price, category }) => {
    dessertCards.innerHTML += `
      <div class="dessert-card">
        <h2>${name}</h2>
        <p class="dessert-price">$${price}</p>
        <p class="product-category">Category: ${category}</p>
        <button 
          id="${id}" 
          class="btn add-to-cart-btn">Add to cart
        </button>
      </div>
    `;
  }
);

class ShoppingCart {
  constructor() {
    this.items = [];
    this.total = 0;
    this.taxRate = 8.25;
  }

  addItem(id, products) {
    const product = products.find((item) => item.id === id);
    const { name, price } = product;
    this.items.push(product);

    const totalCountPerProduct = {};
    this.items.forEach((dessert) => {
      totalCountPerProduct[dessert.id] = (totalCountPerProduct[dessert.id] || 0) + 1;
    })

    const currentProductCount = totalCountPerProduct[product.id];
    const currentProductCountSpan = document.getElementById(`product-count-for-id${id}`);

    currentProductCount > 1 
      ? currentProductCountSpan.textContent = `${currentProductCount}x`
      : productsContainer.innerHTML += `
      <div id="dessert${id}" class="product">
        <p>
          <span class="product-count" id="product-count-for-id${id}"></span>${name}
        </p>
        <p>${price}</p>
      </div>
      `;
  }

  getCounts() {
    return this.items.length;
  }

  clearCart() {
    if (!this.items.length) {
      alert("Your shopping cart is already empty");
      return;
    }

    const isCartCleared = confirm(
      "Are you sure you want to clear all items from your shopping cart?"
    );

    if (isCartCleared) {
      this.items = [];
      this.total = 0;
      productsContainer.innerHTML = "";

    }
  }

  calculateTaxes(amount) {
    return parseFloat(((this.taxRate / 100) * amount).toFixed(2));
  }

  calculateTotal() {
    const subTotal = this.items.reduce((total, item) => total + item.price, 0);
    const tax = this.calculateTaxes(subTotal);
    this.total = subTotal + tax;
    cartSubTotal.textContent = `$${subTotal.toFixed(2)}`;
    cartTaxes.textContent = `$${tax.toFixed(2)}`;
    cartTotal.textContent = `$${this.total.toFixed(2)}`;
    return this.total;
  }
};

const cart = new ShoppingCart();
const addToCartBtns = document.getElementsByClassName("add-to-cart-btn");

[...addToCartBtns].forEach(
  (btn) => {
    btn.addEventListener("click", (event) => {
      cart.addItem(Number(event.target.id), products);
      totalNumberOfItems.textContent = cart.getCounts();
      cart.calculateTotal();
    })
  }
);

cartBtn.addEventListener("click", () => {
  isCartShowing = !isCartShowing;
  showHideCartSpan.textContent = isCartShowing ? "Hide" : "Show";
  cartContainer.style.display = isCartShowing ? "block" : "none";
});

Hi, Marvin! Good progress, keep up the good work!

Well, as you were told, please reset the lesson, you need the initial code.

In the starting code in the if (isCartCleared) condition you need to write code on the 154th line of code, right after this line:

productsContainer.innerHTML = "";

In your first post you almost did it right, but as you mentioned here

you need to set a number, not a string.

So take
totalNumberOfItems.textContent
cartSubTotal.textContent
cartTaxes.textContent
cartTotal.textContent

and set them all to the number 0, not a string, also don’t add any other symbols and quotes.

One more reminder not to change the given code, just place these 4 lines in the 154th, 155th, 156th and 157th lines in the code editor.

Hope this helps, Marvin!