Skip to content

[Bug] Cart Drawer UI desync: No refresh on 422 error when max inventory is reached #3921

Description

@salvymc

Describe the current behavior

When a user attempts to add a quantity of an item that exceeds the available stock, the server correctly returns a 422 Unprocessable Entity error. However, the Cart Drawer (off-canvas) fails to handle this exception gracefully.

Instead of displaying the error message, the UI becomes unresponsive. The Cart Drawer remains "stuck" in a loading or stale state, and the user is unable to interact with the cart until the page is manually refreshed. The browser console explicitly shows the failed POST request to /cart/add.js without any subsequent error handling by the theme's JavaScript.

Describe the expected behavior

The UI should automatically fetch and re-render the cart items to reflect the actual quantities added by the server, ensuring the user sees the updated state without needing a manual page refresh.

Version information (Dawn, browsers and operating systems)

  • Dawn Version: 15.4.1
  • Chrome Version 147.0.7727.138
  • macOS Version 14.8.3 (23J220)

Additional context/screenshots

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions