DEV Community

Md Mijanur Molla
Md Mijanur Molla

Posted on

I Created a Shopping Cart Challenge… And AI Calculated the Wrong Total

Shopping carts look simple.

Add item → calculate total → done.

That’s what I thought.

So I created a small challenge on VibeCode Arena to test this.

And things got interesting very quickly.


🚨 The Problem

At first glance, the logic works.

  • Add items
  • Remove items
  • Calculate total

Everything seems correct.

But in real-world systems, this breaks.


⚠️ What Goes Wrong?

In real e-commerce systems:

• Same product can be added multiple times

• Quantity matters

• Prices can change

• Frontend and backend can go out of sync

And suddenly:

👉 Total becomes incorrect

👉 Users see wrong prices

👉 Orders fail

This is a real production issue.


🧠 What I Observed

When testing this challenge:

• Some solutions ignored quantity

• Some didn’t handle duplicate items

• Some assumed price never changes

• Very few handled real-world scenarios

The code works.

But the system is not reliable.


🔍 The Real Issue

This is not a math problem.

It’s a data consistency problem.

Because:

👉 Total depends on correct state

👉 State changes over time

👉 Systems must stay in sync


🔥 Try My Challenge

I created this challenge to test real-world product thinking.

👉 Try it here:
https://vibecodearena.ai/duel/d1bcd6dc-f9b6-4a37-a3fb-835ba0fd46fc

Can you:

  • Fix incorrect totals?
  • Handle quantity properly?
  • Keep data consistent?

💡 Final Thought

Shopping carts don’t fail because of math.

They fail because of state management.

And that’s where real engineering begins.


Try it and tell me 👇

Did AI get the total right… or miss something important?

Top comments (0)