fix(ep-commerce): cart mutation errors and multilocation quantity updates - #400
Open
mzaintariq wants to merge 1 commit into
Open
fix(ep-commerce): cart mutation errors and multilocation quantity updates#400mzaintariq wants to merge 1 commit into
mzaintariq wants to merge 1 commit into
Conversation
…tion Make proxy mutations reject on failure, recover multilocation location on quantity updates, and harden cart quantity controls with in-flight handling and optimistic rollback. Issue #392
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
null.$ctx.addToCartState.error.locationon quantity updates.What changed
Error handling
callEpProxynow throws when no fallback is supplied, while reads can continue to soft-fail by passing an explicit fallback:Elastic Path add/update/remove mutations also validate SDK
{ error }responses instead of treating them as successful.Add to Cart
Failures now reach the existing Studio-facing state:
Previous errors are cleared on a new attempt, and
onAddedToCartonly runs after a successful mutation.No default toast or banner is added; designers can bind their own UI to the error state.
Multilocation quantity updates
Cart-line
locationis retained aslocationSlugand passed with quantity updates.If location is missing from the client request, the server attempts to recover it from the existing cart line before updating Elastic Path.
This fixes repeated multilocation +/- failures and incorrect insufficient-stock errors during decrement.
Quantity / remove
Quantity updates now:
Remove now rejects proxy/SDK failures and refreshes the cart after success. Failed remove leaves the item in the cart.
Quantity/remove errors remain log-only in this MR.
Designer impact
Designers can bind custom error UI to
$ctx.addToCartState.error.Existing projects will not automatically display an error unless UI is bound to that value.
Implementor notes
callEpProxycalls now reject on failure.location; if omitted, the server may perform an additional cart read to recover it.Testing
Automated
git diff --check: passedCoverage includes proxy strict/fallback behaviour, SDK soft errors, ATC error/callback handling, multilocation location passing/recovery, quantity rollback/in-flight behaviour, stock limits, remove behaviour, and button accessibility/Studio preview states.
Manual
Verified:
locationpresent in update requestsFixes #392