Skip to content

fix(pdp): redirect to cart page on mobile after edge add-to-cart#718

Open
dylandepass wants to merge 3 commits into
staginguatfrom
mobile-atc-redirect
Open

fix(pdp): redirect to cart page on mobile after edge add-to-cart#718
dylandepass wants to merge 3 commits into
staginguatfrom
mobile-atc-redirect

Conversation

@dylandepass

@dylandepass dylandepass commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

On mobile the header cart badge update is too subtle — users don't notice the item was added and mash the button. After a successful edge-checkout add-to-cart on viewports < 900px, redirect to the cart page. Adds Cart.flush() to force a synchronous localStorage write before the redirect, avoiding a race where the debounced persist (300ms) hasn't fired yet.

Also fixes a pre-existing test failure where paypal-express.spec.js crashed with "window is not defined" — extracts isEstimateExpiringSoon into scripts/estimate-token.js to break the transitive import chain into commerce-config.js.

Test URLs:

@aem-code-sync

aem-code-sync Bot commented Jul 16, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run all PSI checks
  • Re-run failed PSI checks
  • Re-sync branch
Commits

@aem-code-sync

aem-code-sync Bot commented Jul 16, 2026

Copy link
Copy Markdown
Page Scores Audits Google
📱 / PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ / PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

On mobile the header cart badge update is too subtle — users don't notice the item was added and mash the button. After a successful edge-checkout add-to-cart on viewports < 900px, redirect to the cart page. Adds Cart.flush() to force a synchronous localStorage write before the redirect, avoiding a race where the debounced persist (300ms) hasn't fired yet.
@dylandepass
dylandepass force-pushed the mobile-atc-redirect branch from c6e7f29 to e006fe7 Compare July 16, 2026 15:43
@dylandepass

Copy link
Copy Markdown
Contributor Author

/run-tests

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

Integration tests failed.

🔍 Check the workflow run for details
📊 Test report will be available in the artifacts section.

@aem-code-sync
aem-code-sync Bot temporarily deployed to mobile-atc-redirect July 16, 2026 16:18 Inactive
paypal-express.spec.js crashed with 'window is not defined' because importing paypal-context.js transitively loaded checkout-order.js → commerce-api.js → commerce-config.js, which reads window.location at the top level. Extracts isEstimateExpiringSoon into scripts/estimate-token.js so paypal-context.js no longer drags in the commerce stack. checkout-order.js re-exports the function for backward compatibility.
@dylandepass
dylandepass force-pushed the mobile-atc-redirect branch from c362142 to 7ace7b8 Compare July 16, 2026 16:23
@aem-code-sync
aem-code-sync Bot temporarily deployed to mobile-atc-redirect July 16, 2026 16:23 Inactive
@dylandepass

Copy link
Copy Markdown
Contributor Author

/run-tests

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

Integration tests failed.

🔍 Check the workflow run for details
📊 Test report will be available in the artifacts section.

@aem-code-sync
aem-code-sync Bot temporarily deployed to mobile-atc-redirect July 16, 2026 17:04 Inactive
@dylandepass

Copy link
Copy Markdown
Contributor Author

/run-tests

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

Integration tests failed.

🔍 Check the workflow run for details
📊 Test report will be available in the artifacts section.

…ests

Mobile add-to-cart now redirects to the cart page, so Playwright tests running at mobile viewports can no longer wait for the button to re-enable. Updated clickAndWait helpers to race the button re-enable against a /order/cart navigation and navigate back to the PDP when the redirect fires.
@dylandepass

Copy link
Copy Markdown
Contributor Author

/run-tests

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

Integration tests failed.

🔍 Check the workflow run for details
📊 Test report will be available in the artifacts section.

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