feat(my-account): build v2 prototype payment methods (Phase 6)#4682
Merged
thomasguillot merged 2 commits intoApr 28, 2026
Merged
Conversation
Reproduces WC core's /my-account/payment-methods/ page byte-for-byte under the ?v2-demo flag, fed by fake data instead of wc_get_customer_saved_methods_list. Same template_redirect priority-8 takeover pattern Phase 4 uses for subscriptions: drops both WC core's default renderer and v1's wc_get_template swap to payment-information.php so the v2 template is the sole handler. - Adds 'payment-methods' to the v2 sidebar between Subscriptions and the rest - Bumps ENDPOINTS_VERSION 4 -> 5 to re-fire the auto-flush guard once - Snackbar-only dispatcher (Make default / Delete / Add new) — no modals
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Phase 6 of the My Account v2 demo prototype by taking over WooCommerce’s /my-account/payment-methods/ endpoint under ?v2-demo=1 (admin-only), rendering a WC-core-shaped table backed by fake card data and wiring the action links to snackbar-only stubs.
Changes:
- Introduces a new v2-demo Payment Methods template and fake-data slice, plus a
template_redirecttakeover to make it the sole renderer in demo mode. - Adds client-side click interception for “Make default / Delete / Add payment method” to show snackbars (no real mutations).
- Updates v2-demo sidebar ordering to include “Payment methods” and documents Phase 6 decisions in the devlog.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/my-account/v2-demo/payment-methods.js | Adds snackbar-only click handling for payment-method actions via data-action. |
| src/my-account/v2-demo/index.js | Loads the new payment-methods client module into the v2-demo bundle. |
| includes/plugins/woocommerce/my-account/templates/v2-demo/payment-methods.php | New WC-core-structured payment-methods table template driven by fake data + data-action hooks. |
| includes/plugins/woocommerce/my-account/class-my-account-ui-v2-demo.php | Adds endpoint renderer + takeover logic, bumps endpoint version, inserts “Payment methods” into menu, and adds fake payment-method data. |
| docs/my-account-v2-prototype-devlog.md | Records Phase 6 implementation details and cross-phase decisions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
All Submissions:
Changes proposed in this Pull Request:
Phase 6 of the My Account v2 prototype. Reproduces WC core's
/my-account/payment-methods/page byte-for-byte under the?v2-demo=1flag, fed by fake card data instead ofwc_get_customer_saved_methods_list(). Admin-only, gated behind the sameis_demo_active()helper every prior phase uses; production users on/my-account/payment-methods/continue to see v1's existing card-based "Payment information" surface.The
template_redirect-priority-8 takeover (mirroring Phase 4's subscriptions takeover) drops both WC core's defaultwoocommerce_account_payment_methodscallback and v1'swc_get_templateswap topayment-information.phpin one move, and re-adds our renderer so the v2 template is the sole handler. Sidebar gains a new "Payment methods" entry between Subscriptions and the rest. Make default / Delete / Add new are snackbar-only stubs — no modals this phase.ENDPOINTS_VERSIONis bumped 4 → 5 so the auto-flush guard re-runs once on the next admin visit. No new rewrite endpoint is registered (payment-methodsis owned by WC core); the bump exists to keep rewrite rules clean and the audit trail consistent across phases.Devlog entry + cross-phase decision rows added in the same change. See docs/my-account-v2-prototype-devlog.md Phase 6 for the full design log.
This PR targets
prototype/my-account-demo(nottrunk); the umbrella tracker is #4679.How to test the changes in this Pull Request:
npm run build(ornpm startfor watch mode).ENDPOINTS_VERSIONbump combined with PHP opcache can leave the takeover registered before the new code is loaded. Run:Other information: