Skip to content

Preserve accepted cart adds through section failures and deferred quick-add rendering - #3994

Open
ToukoUrsin wants to merge 1 commit into
Shopify:mainfrom
ToukoUrsin:fix/accepted-cart-add-section-fallback
Open

ToukoUrsin wants to merge 1 commit into
Shopify:mainfrom
ToukoUrsin:fix/accepted-cart-add-section-fallback

Conversation

@ToukoUrsin

@ToukoUrsin ToukoUrsin commented Oct 5, 2026 •

Copy link
Copy Markdown

PR Summary

When a product has been added but its cart sections cannot render, show the cart page so the customer can see the accepted add without submitting it again. Preserve the existing cart content until valid sections are ready or navigation begins.

Why are these changes introduced?

An accepted add can contain null sections. Deferred quick-add rendering also leaves a window for another form to submit before the first response is rendered. This addresses the null-section failure discussed in #613 and the related deferred-render case.

What approach did you take?

Validate required section fragments and targets before replacing content. On failure, navigate to the configured cart URL. Guard shared forms while deferred rendering or navigation is pending; release the render guard in finally and clear navigation state on persisted pageshow. Remove empty-cart state only after valid drawer replacement.

Other considerations

No runtime dependencies are added. Local fixtures use original theme components with synthetic transport. Real Shopify service behavior, full product-info flows, subscriber races, persisted back-forward cache and screen-reader speech remain untested. Partial or unknown mutations are outside scope. Failed fallback navigation leaves the page guarded. Complete independent review remains pending.

Shopify requires a CLA before merge. The CLA check reports that @ToukoUrsin must sign it. I have not signed it as part of this submission; this PR remains a draft pending the CLA and platform validation.

Decision log

Use the cart page as the fallback after an accepted add, because it can display the authoritative cart without repeating the mutation.

Visual impact on existing themes

The normal successful cart surface is unchanged. Invalid sections lead to the cart page; the previous cart content remains visible until navigation.

Testing steps/scenarios

  • Return an accepted add with a null cart section from quick-add, then from the ordinary product form, for both drawer and notification. Confirm navigation without a repeated add.
  • Submit another form synchronously during modal closure. Confirm the deferred-render guard prevents it.
  • Verify valid sections, focus and Escape return, then reopen quick-add and add again. Verify a known rejected add permits an intentional retry.

Recorded Chromium fixtures pass 73/73 scenarios versus 16/73 upstream (1,154 matched checks). All three exact replacements match that tested patch. Fresh JavaScript syntax checks pass; fresh Theme Check reports zero errors and nine existing warnings. The browser fixtures were not rerun for this submission.

Demo links

No development-store demo is included; platform acceptance remains pending.

Checklist

  • Added PR summary for release notes
  • Followed theme code principles
  • Linted with Theme Check
  • Requested UX review
  • Tested on real mobile browsers
  • Tested on multiple browsers
  • Tested with assistive technology

Touko Ursin, Helios One. AI assistance was used for implementation, tests and submission.

@ToukoUrsin

Copy link
Copy Markdown
Author

I have signed the CLA!

@ToukoUrsin
ToukoUrsin marked this pull request as ready for review October 10, 2026 21:45

This branch has not been deployed

No deployments
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.

1 participant