-
Notifications
You must be signed in to change notification settings - Fork 72
fix: WC Core payment method activation URL fix #11141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where WooCommerce Core sends emails with links to individual payment method settings pages (e.g., woocommerce_payments_klarna) that don't exist, resulting in blank pages. The fix redirects these non-existent payment-method-specific URLs to the main WooPayments settings page.
- Adds redirect logic to handle payment-method-specific settings URLs
- Implements comprehensive test coverage for the redirect functionality
- Uses
admin_inithook with priority 16 to intercept and redirect before page rendering
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| includes/admin/class-wc-payments-admin-settings.php | Adds maybe_redirect_payment_method_settings() method that redirects payment-method-specific URLs (e.g., woocommerce_payments_klarna) to the main WooPayments settings page |
| tests/unit/admin/test-class-wc-payments-admin-settings.php | Adds comprehensive test coverage for the redirect functionality including positive/negative test cases and permission checks |
| changelog/fix-payment-method-activation-redirect | Documents the fix in the changelog as a patch-level change |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
|
Size Change: 0 B Total Size: 876 kB ℹ️ View Unchanged
|
Fixes WOOPMNT-5512
Changes proposed in this Pull Request
When a new payment method is activated, WC Core will send an email to the site admin to alert them of the change.
The email contains the link to the individual payment method.
In case of WooPayments, if you activate Klarna (for example), WC Core will include this URL in the email:
/wp-admin/admin.php?page=wc-settings&tab=checkout§ion=woocommerce_payments_klarna.But if you access this URL, you get a blank page.
That's because the individual payment method settings are handled in the main WooPayments settings page.
So we need to (instead) show the main WooPayments settings page.
Testing instructions
You can test this in two ways.
The fastest way:
/wp-admin/admin.php?page=wc-settings&tab=checkout§ion=woocommerce_payments_wechat_payon your siteThe more complete way:
Payment gateway "WooPayments" enabledIf you did not enable this payment gateway, please log in to your site and consider disabling it here:npm run changelogto add a changelog file, choosepatchto leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge