Open kmjamsheed0 opened 1 week ago
I can confirm this happens with WooCommerce 9.4.0-beta.2 and WordPress 6.7-beta1-59158
The notice has since been updated to
_load_textdomain_just_in_time
means that WooCommerce hasn't yet called load_plugin_textdomain
(which is happening correctly on init
) but a i18n function with the woocommerce
textdomain was already called and WordPress is trying to load the domain "just in time".
In this case, the first string loaded is "WooCommerce" which makes me to believe this is caused by a call to get_plugin_data
before init
, because this functions tries to get the plugin name localized, unless you pass
false to its third parameter (which is how I fixed it on my plugins).
I haven't been able to replicate the error log using WC 9.3.3 or 9.4 beta.2 along with WP 6.7-beta2. @kmjamsheed0 @webdados do you still get this with the WP beta2? If so, are there any other plugins involved? Could you provide some more detailed reproduction steps?
Hi @coreymckrill ,
I'm currently not experiencing the error anymore. I'm using WooCommerce 9.4.0-beta.2 and WordPress 6.7-beta2-59195, and everything seems to be working fine now. It appears that the issue has been resolved with these updates.
Thank you for checking in!
Just made a fresh install to be sure it was not caused by my dev (messy) install π and the notice is showing up
Hi @coreymckrill
After further testing, Iβm unfortunately encountering the error again, but this time it seems to be happening specifically when I visit a translated WooCommerce page.
I'm still using WooCommerce 9.4.0-beta.2 and WordPress 6.7-beta2-59195, but the issue seems tied to the translation aspect of WooCommerce. Could you please advise if there have been any related updates?
Thank you for checking in!
Yeah, probably people are testing with WordPress set to English :-) They need to change the language.
Yeah, probably people are testing with WordPress set to English :-) They need to change the language.
@webdados That makes sense! It seems like the issue is more noticeable when using translation.
It's not only mode noticeable as it is unique to non English. "Load text domain" does nothing if WordPress is set to the default language.
Actually it looks worse, because the translation is not loading at all (still using the same fresh website mentioned above). Look as WooCommerce strings are the only one in English and not Portuguese:
Also, I can't place an order from the translated checkout page because the cart is stuck in an endless AJAX loading loop in the order review section.
Also, I can't place an order from the translated checkout page because the cart is stuck in an endless AJAX loading loop in the order review section.
That's because of the PHP notice. It's normal. Once the underlying issue is solved, that will go away.
The thing is... will the be fixed in the final release of 9.4? I really hope so.
I solved the issue in my personal project by firing the load_plugin_textdomain
function after WooCommerce setup. I achieved this by using the after_setup_theme
hook:
$this->loader->add_action( 'after_setup_theme', $plugin_i18n, 'load_plugin_textdomain' );
Alternatively, you can use any hook that fires after the plugins_loaded
hook, which ensures that all plugins are fully loaded.
WordPress 6.7 requires that the text domains are only loaded on init
or later.
https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/l10n.php#L1344
Prerequisites
Describe the bug
I'm currently running WordPress 6.7.0-beta, and I'm encountering the following error when visiting a product page or interacting with WooCommerce menus:
Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the woocommerce domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.)
The error seems to indicate that the translation loading for WooCommerce is happening too early in the execution order, likely due to a plugin or theme code being triggered prematurely.
Expected behavior
No errors related to translation loading should be triggered during normal WooCommerce usage.
Actual behavior
The error message about _load_textdomain_just_in_time is displayed, indicating that translation loading was triggered too early.
Steps to reproduce
WordPress Environment
WordPress Version: 6.7-beta1-59156 WooCommerce Version: 9.3.3 Theme: Storefront
Isolating the problem