[Backport to release/10.7] [WOOPLUG-6477] fix: fix _load_textdomain_just_in_time warning in FulfillmentsController::register_data_stores#63893
Conversation
…illmentsController::register_data_stores (#63888) * [WOOPLUG-6477] fix: fix _load_textdomain_just_in_time warning in FulfillmentsController::register_data_stores * Use get_option() instead of feature_is_enabled() in register_data_stores The woocommerce_data_stores filter can fire before the 'init' action (e.g. when WC Payments initializes during plugins_loaded). Calling FeaturesController::feature_is_enabled() at that point triggers init_feature_definitions() which uses __() for translations, causing a _load_textdomain_just_in_time warning. Check the option directly with get_option(), matching the pattern used in OrdersVersionStringInvalidator, TaxRateVersionStringInvalidator, and ProductVersionStringInvalidator. * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: woocommercebot <woocommercebot@users.noreply.github.com>
Testing GuidelinesHi @tpaksu , Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit. |

This PR is a cherry-pick of #63888 to
release/10.7.Original PR Description
Submission Review Guidelines:
Changes proposed in this Pull Request:
Fixes
_load_textdomain_just_in_timewarning triggered whenFulfillmentsController::register_data_stores()callsFeaturesController::feature_is_enabled()before theinitaction fires.When plugins like WC Payments call
WC_Data_Store::load()duringplugins_loaded, thewoocommerce_data_storesfilter fires, andfeature_is_enabled()triggersinit_feature_definitions()which uses__()for translations. This causes WordPress to warn about loading textdomains too early.The fix checks the option directly with
get_option()instead of going throughFeaturesController::feature_is_enabled(), matching the established pattern inOrdersVersionStringInvalidator,TaxRateVersionStringInvalidator, andProductVersionStringInvalidator.Related issue: WOOPLUG-6477
Screenshots or screen recordings:
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
WC_Data_Store::load()duringplugins_loaded)WP_DEBUGandWP_DEBUG_LOGwp-content/debug.logfor_load_textdomain_just_in_timewarnings related to the woocommerce textdomainTesting that has already taken place:
Milestone
Automatically assign milestone for the next WooCommerce versionChangelog entry
Automatically create a changelog entry from the details below.This Pull Request does not require a changelog entry. (Comment required below)Changelog Entry Details
Significance
Type
Message
Fix _load_textdomain_just_in_time warning in FulfillmentsController by checking feature option directly instead of using FeaturesController::feature_is_enabled() before init action.
Changelog Entry Comment
Comment