[X] I have carried out troubleshooting steps and I believe I have found a bug.
[X] I have searched for similar bugs in both open and closed issues and cannot find a duplicate.
Describe the bug
An error occurs when changing the site language in WordPress.
Steps to reproduce
Install WordPress 6.7 & WooCommerce 9.4.1.
Change the WordPress site language to some other language.
You will see the error in the debug log and the query monitor.
Error -
Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the custom-order-numbers-for-woocommerce domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. (This message was added in version 6.7.0.)
PHP Warning: Invalid argument supplied for foreach() in /home/kacamezazo5745/web/frac.instawp.xyz/public_html/wp-content/plugins/custom-order-numbers-for-woocommerce/includes/class-alg-wc-custom-order-numbers-core.php on line 270
Expected behavior
There should be no warnings/errors displayed from our plugin.
WordPress Environment
No
Isolating the problem
[X] I have deactivated other plugins and confirmed this bug occurs when only our plugin is active.
[X] This bug happens with a default WordPress theme active, or Storefront.
[X] I can reproduce this bug consistently using the steps above.
When using the Loco Translate plugin for translation with the 'system' location, the error still appears. There should be no errors for the location selected using the Loco Translate plugin.
Prerequisites
Describe the bug
An error occurs when changing the site language in WordPress.
Steps to reproduce
Error - Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the custom-order-numbers-for-woocommerce domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. (This message was added in version 6.7.0.)
PHP Warning: Invalid argument supplied for foreach() in /home/kacamezazo5745/web/frac.instawp.xyz/public_html/wp-content/plugins/custom-order-numbers-for-woocommerce/includes/class-alg-wc-custom-order-numbers-core.php on line 270
Expected behavior
There should be no warnings/errors displayed from our plugin.
WordPress Environment
No
Isolating the problem
Additional field
No response