ecommerce_sanity_stripe icon indicating copy to clipboard operation
ecommerce_sanity_stripe copied to clipboard

UNABLE TO ADD DIFFERENT ITEMS TO CART. KEEPS ADDING SAME ITEM TO CART (FIRST ITEM)

Open Gerwyn1 opened this issue 2 years ago • 9 comments

Unable to add different items to cart, always add same/initial item. i have cloned this project and still not work. edit: Error message on the right solved but the issue in the title remains.

image

Gerwyn1 avatar Apr 26 '22 19:04 Gerwyn1

in Cart component at line number 78, remove that onClick="", then you don't get this error...

taiseen avatar Apr 26 '22 20:04 taiseen

the error is gone but sadly im still unable to add different cart items. any idea? trying to add other items, only ends up adding the first item only.

Gerwyn1 avatar Apr 26 '22 20:04 Gerwyn1

I'm not sure why it's happening at your end... so let's add some screen short here to see what is going on at your project?

taiseen avatar Apr 26 '22 20:04 taiseen

Again i've added the 2nd item (x2) and 3rd item (x3) and it added the first item (x5) to the cart. also the console has no more errors.

image

Gerwyn1 avatar Apr 26 '22 20:04 Gerwyn1

Don't mind... I think you may have missed conception to understand this thing because that 2nd or 3rd item you can't add because they are already part of the 1st product item. These pictures are just another-looking version of that specific product that you already added to your cart & after adding the product into the cart you can only see just 1st picture from that product.

So it's not an error, it's a feature behavioral pattern 🙂

taiseen avatar Apr 26 '22 20:04 taiseen

But how? Just before I copy pasted the github code, it was working fine.

'These pictures are just another-looking version of that specific product that you already added to your cart'

But I manually added the items to sanity CMS.

I'm guessing the github source code actually has bugs

Gerwyn1 avatar Apr 26 '22 23:04 Gerwyn1

From what I see you need to create a separate products in Sanity dashboard, not just add different pictures to the same product.

beaxion avatar Apr 27 '22 10:04 beaxion

From what I see you need to create a separate products in Sanity dashboard, not just add different pictures to the same product.

Nope. Didn't work. I've added different products once again (this time smartwatch)

image

image

Also, i followed the exact steps in the tutorial video, what adrian did.

also there's this bug too for some reason: image

Gerwyn1 avatar Apr 27 '22 11:04 Gerwyn1

same problem its a bug when add one item than add another item multiple time its is item._id is is undefianed why

meetsmarttechnica avatar May 14 '22 05:05 meetsmarttechnica