Fix fatal error: missing WC_Payments_Explicit_Price_Formatter in loan note#11358
Open
Fix fatal error: missing WC_Payments_Explicit_Price_Formatter in loan note#11358
Conversation
…an note Add require_once for class-wc-payments-explicit-price-formatter.php in handle_loan_approved_inbox_note() to ensure the class is loaded before the loan approved note's get_note() method uses it. The class was only included at line 720 of WC_Payments::init(), but the loan note handler can fire earlier during payment method construction (line 598) when the account data cache is refreshed. Fixes WOOPMNT-5740 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verifies that get_note() creates a valid WC Admin note with the expected content about capital loan approval. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
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. |
Contributor
|
Size Change: 0 B Total Size: 956 kB ℹ️ View Unchanged
|
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.
Fixes WOOPMNT-5740
Changes proposed in this Pull Request
The plugin crashes with
Fatal error: Class "WC_Payments_Explicit_Price_Formatter" not foundin the loan approved admin inbox note. This happens when the account data cache is refreshed during payment method construction inWC_Payments::init(), before the formatter class has been included (line 720).The fix adds a
require_onceforclass-wc-payments-explicit-price-formatter.phpinhandle_loan_approved_inbox_note(), right alongside the existingrequire_oncefor the loan note file itself. This is idempotent and follows the same pattern already used in the method.Testing instructions
npm run test:php -- --filter=WC_Payments_Notes_Loan_Approved_Testnpm run test:php -- --filter=test_handle_loan_approved_inbox_notenpm run changelogto add a changelog file, choosepatchto leave it empty if the change is not significant.Post merge