Commit 45f105379e3 for woocommerce
commit 45f105379e3f5cd17dea66e272110ca1fb90551f
Author: Taha Paksu <3295+tpaksu@users.noreply.github.com>
Date: Fri Mar 27 12:24:50 2026 +0300
[WOOPLUG-6477] fix: fix _load_textdomain_just_in_time warning in FulfillmentsController::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>
diff --git a/plugins/woocommerce/changelog/63888-fix-wooplug-6477-fix-_load_textdomain_just_in_time-warning-in b/plugins/woocommerce/changelog/63888-fix-wooplug-6477-fix-_load_textdomain_just_in_time-warning-in
new file mode 100644
index 00000000000..b94eda45853
--- /dev/null
+++ b/plugins/woocommerce/changelog/63888-fix-wooplug-6477-fix-_load_textdomain_just_in_time-warning-in
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Fix _load_textdomain_just_in_time warning in FulfillmentsController by checking feature option directly instead of using FeaturesController::feature_is_enabled() before init action.
\ No newline at end of file
diff --git a/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsController.php b/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsController.php
index 3e28b733323..3723b1ddf15 100644
--- a/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsController.php
+++ b/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsController.php
@@ -48,11 +48,11 @@ class FulfillmentsController {
return $data_stores;
}
- $container = wc_get_container();
- $features_controller = $container->get( FeaturesController::class );
-
- // If fulfillments feature is not enabled, don't register the data store.
- if ( ! $features_controller->feature_is_enabled( 'fulfillments' ) ) {
+ // Check the option directly instead of using FeaturesController::feature_is_enabled()
+ // because the woocommerce_data_stores filter can fire before the 'init' action
+ // (e.g. from WC Payments during 'plugins_loaded'), and feature_is_enabled() would
+ // trigger translation loading too early, causing _load_textdomain_just_in_time warnings.
+ if ( 'yes' !== get_option( 'woocommerce_feature_fulfillments_enabled', 'no' ) ) {
return $data_stores;
}