Since Saturday, 2 items are being added to cart

Short description of issue

Since Saturday, 2 items are being added to cart

Reproduction steps

Since Saturday, our app is experiencing a weird behavior. Everything was working fine for 3-4 years and we didn’t changed anything on our end.

The add to cart event listener adds 2 quantities to cart. When the quantity is decreased in cart, the product is removed.

We got at least 20 support emails from multiple different regarding this issue and we had to disable our Add To Cart event listeners for the time being to temporarily fix this issue.

Additional info

Does anyone knows why this is suddenly happening?
Merchants are thinking our app is broken because of this.

What type of topic is this

Bug report

Yes, we are facing that same issue today, please can u let me know which shopify theme are you using ?

There was a recent change to the Cart API:

There must be only 1 add to cart event listener.

If there are 2 events listeners, you will get a product with multiple quantities in cart.
Anyway, I’ve been using event.stopImmediatePropagation() and event.preventDefault() with partial success, however, it doesn’t work all the time.

The alternative is to disable the additional ATC event.

Also see the tangential RFC that may help this concurrency behavior, or worsen it /shrug.