Case study
10X Health Network
Putting mandatory consent inside checkout, where it cannot be skipped
- Sector
- healthcare
- Year
- 2026
- Role
- Frontend engineer
- consent captureblocking, not advisory
- in-checkout
- visual regression gatePlaywright + pixelmatch in CI
- px-diff
- Shopify Checkout UI Extensions
- TypeScript
- React
- Playwright
- pixelmatch
- GSAP
- zustand
01
The problem
Certain products could not be sold without the customer affirmatively acknowledging specific terms. The obvious implementation — a checkbox on the product page, or a modal in the cart — is not actually a control. Carts are recoverable, links are shareable, and checkout can be reached directly. Anything outside checkout is a suggestion.
Shopify's checkout is also not yours to modify. You cannot inject a script into it.
02
Approach
The consent forms are a Checkout UI extension: they render inside Shopify's own checkout, in a sandboxed context, and they can genuinely block completion until satisfied. Which products require which consent is driven by configuration rather than hardcoded, so adding a regulated product later is a merchandising change and not a deploy.
The constraint that shaped the code is that extensions run in a restricted sandbox with a component-only rendering surface — no DOM access, no arbitrary CSS. Everything has to be expressed through the provided primitives, which is genuinely a better discipline than it sounds: the result is accessible and native-looking by construction rather than by effort.
- Consent requirements resolved per-product from configuration, not from hardcoded IDs
- Completion blocked until required acknowledgements are given
- Built entirely within the checkout extension component surface — no DOM escape hatches
03
The testing harness
The wider theme is where I set up visual regression: Playwright drives the storefront across the breakpoint set, and pixelmatch diffs the captures against approved baselines in CI. Themes are exceptionally prone to invisible breakage — a change to a shared snippet can shift a section on a page nobody thought to open — and unit tests do not catch layout.
The value is not in catching bugs I knew about. It is in catching the ones on pages I was not looking at.
- Screenshot baselines at every supported breakpoint, from 390px up
- Pixel-diff thresholds tuned per surface so antialiasing noise does not produce false failures
- Runs in CI, so a regression blocks the merge rather than reaching the store