-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔥 Ajax Cart Quantity Bug #2994
Comments
I can replicate as well! |
The same thing is happening with the "change.js" endpoint! |
We are impacted by this as well. The documentation confirms that the expected behavior should not add any product. Actually, I realized that the behavior is even inconsistent across stores. We have tested some stores where it behaves as instructed in the doc (no product are added in case of error), while some add all the available quantity. @ludoboludo is it possible to escalate this issue? |
Thanks for the flag. Ill track down where the progress on this is 👍 And/or at least make sure there is awareness of the fact that it's still an issue that is impacting negatively merchants and their customers. |
Hi @ludoboludo |
There isn't at the moment 🤔 I've relayed the information to the team in question. I'm not sure what's on their current plate and where that will sit in terms of priority though. |
Hello! I've encountered this problem while working with a third-party theme, and I've also replicated it using the Dawn theme from the store. Given that this store offers very affordable items, it's not uncommon for customers to enter a quantity that exceeds the available stock, so this has become a significant pain point for the merchant. Int: https://app.shopify.com/services/internal/shops/74639049002 |
Hi, I am working on store development and using the dawn theme give me same behaviour. Cart drawer section not load when /cart/add.js response status is 422. Theme developer not handle this bug and I am very strange that why dawn is not remove this bug in very release. |
So the documentation has been updated to reflect that the maximum quantity possible will be added to the cart while erroring. We would now need to tweak our handling of that error to clearly show the user what happened. |
Hi @ludoboludo, It doesn't make sense that an add to cart can be done, but that the API return is an error. If you think it makes more sense to add to cart, then the API return should be a success and not an error. |
Describe the current behavior
When attempting to add a quantity of products larger than what's available, the theme:
If I then try to reduce the product quantity, the theme throws another error that the specified number of products is already in the cart. However, the "drawer" and "cart bubble" only reflect the correct quantity after a page refresh.
Describe the expected behavior
When sending an Ajax request that results in an error, the theme should not add any products to the cart. Additionally, the "drawer" and "cart bubble" should always reflect the correct quantity of products in the cart without requiring a page refresh.
Version information (Dawn, browsers and operating systems)
11.0.0
117.0.5938.62
117.0.1
13.5.2
Possible solution
The issue seems to originate from the
cart API
. A potential solution would be to ensure that no products are added to the cart in such scenarios and that the UI elements ("drawer" and "cart bubble") are updated appropriately.Additional context/screenshots
I've observed this behavior not only in the Dawn theme but also in other themes on the Shopify theme store, pointing towards a more generalized issue with
cart API
.Screen.Recording.2023-09-15.at.19.11.49.mp4
The text was updated successfully, but these errors were encountered: