Skip to content

Fix/ep cart qty remove errors - #407

Merged
mzaintariq merged 3 commits into
masterfrom
fix/ep-cart-qty-remove-errors
Aug 12, 2026
Merged

Fix/ep cart qty remove errors#407
mzaintariq merged 3 commits into
masterfrom
fix/ep-cart-qty-remove-errors

Conversation

@mzaintariq

Copy link
Copy Markdown
Collaborator

What does this MR do?

Exposes designer-facing cart drawer mutation errors on $ctx.quantityControl.error and $ctx.removeItemState.error, aligned with the post-#405 proxy stable code architecture (same shopper copy mapping as ATC). Designers can bind these in Studio the same way as $ctx.addToCartState.error.

Changes

  • EPCartItemQuantityControl: track mutation error on DataProvider quantityControl; clear on new attempt / item change; map via shared helper; previewState: "error" sample copy
  • EPCartItemRemoveButton: same pattern for removeItemState
  • New cartMutationErrorCopy helper (shared with ATC) mapping insufficient_stock / no_session → shopper copy; unknown codes (incl. dispatch_failed) → generic fallback
  • Refactor ATC to use the shared helper (behavior unchanged)
  • COMPONENTS.md + cart drawer / helper unit tests

Design decisions

Testing

  • Unit tests: quantityControl.error / removeItemState.error lifecycle, preview sample, insufficient_stock / no_session / dispatch_failed mapping; cart-mutation-error-copy.test.ts
  • Manual (Studio): bound error text under qty control and remove button; verified mapped stock/session errors after exercising mutations (local host; stock + guard temporarily disabled for multilocation max-stock cases — not included in this MR)

Reviewer notes

  • Scope is cart-drawer error exposure + shared copy helper only

@mzaintariq
mzaintariq merged commit d41daf7 into master Aug 12, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants