feat(my-account): build v2 prototype subscriptions (Phase 4)#4680
Merged
thomasguillot merged 2 commits intoApr 28, 2026
Merged
Conversation
Adds the Subscriptions list and detail surfaces for the My Account v2 prototype, behind the admin-only `?v2-demo` gate. Registers a custom `subscriptions` endpoint, bumps ENDPOINTS_VERSION to 4, and takes over WC Subscriptions' default rendering when the demo is active by removing all handlers from `woocommerce_account_subscriptions_endpoint` and re-adding our own. Detail template covers all five Figma variants (active, active no-fees, cancelled, expiring, renewed) from a single file, branched on `status` + `fees_covered`. Pure newspack-ui composition. Devlog + cross-phase decision log updated.
Contributor
There was a problem hiding this comment.
Pull request overview
Phase 4 of the My Account v2 demo adds the Subscriptions surface (list + detail variants) and a Change subscription modal, gated behind ?v2-demo=1 for admins and designed to reuse v1/WCS classnames so existing styling applies.
Changes:
- Register/wire a
subscriptionsrewrite endpoint, including demo-only takeover of the WCS subscriptions renderer. - Add v2-demo Subscriptions list + detail templates (5 variants driven by fake data), plus the Change subscription modal partial.
- Add client-side wiring for subscriptions pages (modal flow + stub snackbars) and update docs/devlog for Phase 4.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/my-account/v2-demo/subscriptions.js | Adds JS wiring for subscriptions list/detail and Change subscription modal flow. |
| src/my-account/v2-demo/index.js | Imports subscriptions wiring into the v2-demo bundle. |
| includes/plugins/woocommerce/my-account/templates/v2-demo/subscriptions.php | New v2-demo subscriptions list endpoint template. |
| includes/plugins/woocommerce/my-account/templates/v2-demo/subscription-details.php | New v2-demo subscription detail template supporting multiple variants. |
| includes/plugins/woocommerce/my-account/templates/v2-demo/partials/change-subscription-modal.php | New modal partial for the Change subscription flow. |
| includes/plugins/woocommerce/my-account/class-my-account-ui-v2-demo.php | Registers endpoint, adds menu item, redirects non-demo visitors, and takes over WCS rendering during demo. |
| docs/my-account-v2-prototype-devlog.md | Adds Phase 4 devlog entry and cross-phase decisions. |
| docs/my-account-v2-prototype-brief.md | Codifies “reuse v1 classnames” rule and reference index. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Update $previous_meta docblock in subscriptions.php to reflect actual behaviour (no list_meta override; $format_date is captured via use, not a callable param). - Thread currency_symbol into change-subscription-modal partial via $args so it stays in lockstep with the list/detail templates instead of hard-coding '$' in the modal. - Drop the unused $status_dot closure in subscription-details.php; the billing-history table renders status dots via the v1 `.newspack-my-account__subscription--order-status-label` SCSS class.
6 tasks
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
Phase 4 of the My Account v2 prototype — Subscriptions list + 5 detail variants + Change subscription modal flow. Admin-only behind
?v2-demo=1. Pure newspack-ui composition + v1 class names so existing_subscriptions.scsspaints v2-demo pages.templates/v2-demo/subscriptions.php) — Active section + Previous section with Cancelled/Expired meta strings. Matches Figma init 1.templates/v2-demo/subscription-details.php) — single template, 5 variants driven bystatus+fees_covered: active, active-no-fees, cancelled, expiring (inline error notice), renewed. Header uses v1'ssubscription-header.phpconventions verbatim (--header / --title / --back-link / --actions-container / --actions-dropdown+Newspack_UI_Icons::print_svg('chevronLeft')). Body uses v1/WCS canonical tables:shop_table.order_details(Amount),shop_table.subscription_details(kv pairs),woocommerce-orders-table--orders(Billing history) with.newspack-my-account__subscription--order-status-labelcolour dots.templates/v2-demo/partials/change-subscription-modal.php) — pulled forward from Phase 5. Two visual steps (select / transaction) cover the four Figma frames (init / Monthly selected / Plan selected / Transaction). Tier picker uses v1's<label class="newspack-ui__input-card current">shape. Transaction step uses Newspack-Blocks'modal-checkoutmarkup conventions (wc_payment_methods,payment_method_stripe,payment_box,form-row form-row-first/last/wide).subscriptionsrewrite endpoint, bumpsENDPOINTS_VERSIONto 4, takes overwoocommerce_account_subscriptions_endpointviatemplate_redirect+remove_all_actionswhen demo is active (suppresses WCS' renderer + Newspack's memberships table). Conditional bounce inredirect_non_demo_v2_endpoints(only fires when WCS not installed). Inserts "Subscriptions" sidebar item after "Donations".prototype/my-account-demorather than stacking on the cumulative draft (feat(my-account): v2 prototype #4679 becomes umbrella tracker).Known polish items (deferred for follow-up)
<a href="#renew">intercepted by JS — should become a no-op once Phase 5 wires the real Renew modal.extrasbucket on fake data is a Phase 4 holding pen; Phase 6 scenario fixtures will collapse it into?v2-demo=expiringetc.Test plan
/my-account/subscriptions/?v2-demo=1as admin — Active section shows sub-001 (Member), Previous section shows sub-cancelled (Patron, "Cancelled on Jan 17, 2023") + sub-expired (Supporter, "Expired on Jun 1, 2023")./sub-001/,/sub-cancelled/,/sub-expiring/,/sub-renewed/,/sub-active-no-fees/./my-account/...link preserves?v2-demo=1.wp eval 'opcache_reset();' && wp option delete newspack_my_account_v2_demo_endpoints_version && wp rewrite flushonce for the endpoint version bump (per Phase 3 devlog).