jeremyL-22
Contesto del problema:
I am trying to create a New Order manually from the admin interface in WooCommerce. The issue can be seen at: link nascosto
Sintomi:
The system crashes when I press the 'Create' button, and I receive a message that a critical error occurred. The problem disappears when the WPML plugin is disabled.
Domande:
Why does the system crash when creating a new order with WPML enabled?
How can I resolve the conflict between WPML and WooCommerce?
jeremyL-22
The element found by the WooCommerce team is:
Hey Jeremy,
Thanks for confirming that disabling WPML resolves the issue. I’ve reviewed the error logs and it looks like the crash happens when WPML’s Multi-Currency feature passes a null value where WooCommerce expects an array.
As a temporary workaround, you could try disabling the multi-currency feature if possible. I’m not super familiar with their plugin, but this guide might help point you in the right direction to determine if that's an option while this bug is fixed: https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/
Next steps are to ensure all your premium plugins including WPML are up-to-date. You can check the changelogs here https://wpml.org/category/changelog/
Then reach out to WPML support with the error details: https://wpml.org/forums/forum/english-support/
jeremyL-22
As proposed by the WooCommerce support, when I disable the WPML Multi-Currency function (remove tick bock in the Multicurrency settings tab). This solves the problem with New Orders manual creation. Thanks to let me know when you have a patch or solution for this bug so I can re-activate the functionality.
Laura
Supporter
Lingue:
Inglese (English )
Italiano (Italiano )
Fuso orario:
Europe/Rome (GMT+01:00)
Salve,
grazie per averci contattato.
Senza sapere qual è esattamente l'errore non siamo in grado di fornire assistenza.
Per favore abilita il debug.log di WordPress , identifica l'errore e riportalo qui.
jeremyL-22
and here is the error log transmitted by WooCommerce Team. Hope it helps you resolve the problem faster:
PHP Fatal error: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in /wordpress/plugins/woocommerce/9.5.2/includes/wc-core-functions.php:1395
Stack trace:
#0 /wordpress/plugins/woocommerce/9.5.2/includes/wc-core-functions.php(1395): array_keys(NULL)
#1 /wordpress/plugins/woocommerce/9.5.2/includes/data-stores/class-wc-customer-data-store-session.php(168): wc_get_customer_default_location()
#2 /wordpress/plugins/woocommerce/9.5.2/includes/data-stores/class-wc-customer-data-store-session.php(157): WC_Customer_Data_Store_Session->set_defaults(Object(WC_Customer))
#3 /wordpress/plugins/woocommerce/9.5.2/includes/class-wc-data-store.php(159): WC_Customer_Data_Store_Session->read(Object(WC_Customer))
#4 /wordpress/plugins/woocommerce/9.5.2/includes/class-wc-customer.php(125): WC_Data_Store->read(Object(WC_Customer))
#5 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/classes/multi-currency/geolocation/Geolocation.php(133): WC_Customer->__construct(144146929, true)
#6 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/classes/multi-currency/geolocation/Geolocation.php(92): WCML\MultiCurrency\Geolocation::getUserCountryByAddress('billing')
#7 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/classes/Multicurrency/Resolver/ResolverForModeLocation.php(19): WCML\MultiCurrency\Geolocation::getUserCountry()
#8 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/classes/Multicurrency/Resolver/ResolverForModeLocation.php(24): WCML\MultiCurrency\Resolver\ResolverForModeLocation->WCML\MultiCurrency\Resolver\{closure}('EUR')
#9 /srv/htdocs/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Logic.php(121): WCML\MultiCurrency\Resolver\ResolverForModeLocation->getClientCurrency(NULL)
#10 [internal function]: WPML\FP\Logic::WPML\FP\{closure}(Object(Closure), Array, NULL)
#11 /srv/htdocs/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array(Object(Closure), Array)
#12 [internal function]: WPML\FP\{closure}(NULL)
#13 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/classes/Multicurrency/Resolver/ComposedResolver.php(30): call_user_func(Object(Closure), NULL)
#14 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/inc/currencies/class-wcml-multi-currency.php(462): WCML\MultiCurrency\Resolver\ComposedResolver->getClientCurrency()
#15 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/inc/currencies/class-wcml-multi-currency-prices.php(696): WCML_Multi_Currency->get_client_currency()
#16 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/inc/currencies/class-wcml-multi-currency-prices.php(757): WCML_Multi_Currency_Prices->check_admin_order_currency_code()
#17 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/inc/currencies/class-wcml-multi-currency-prices.php(728): WCML_Multi_Currency_Prices->filter_currency_option_in_global_secondary_currency('decimal_sep', '.')
#18 /wordpress/core/6.7.1/wp-includes/class-wp-hook.php(326): WCML_Multi_Currency_Prices->filter_currency_decimal_sep_option('.')
#19 /wordpress/core/6.7.1/wp-includes/plugin.php(205): WP_Hook->apply_filters('.', Array)
#20 /wordpress/core/6.7.1/wp-includes/option.php(247): apply_filters('option_woocomme...', '.', 'woocommerce_pri...')
#21 /wordpress/plugins/woocommerce/9.5.2/includes/wc-formatting-functions.php(528): get_option('woocommerce_pri...')
#22 /wordpress/plugins/woocommerce/9.5.2/includes/wc-formatting-functions.php(292): wc_get_price_decimal_separator()
#23 /wordpress/plugins/woocommerce/9.5.2/includes/abstracts/abstract-wc-order.php(730): wc_format_decimal('0', false, true)
#24 /wordpress/plugins/woocommerce/9.5.2/includes/abstracts/abstract-wc-data.php(801): WC_Abstract_Order->set_discount_total('0')
#25 /wordpress/plugins/woocommerce/9.5.2/includes/data-stores/abstract-wc-order-data-store-cpt.php(180): WC_Data->set_props(Array)
#26 /wordpress/plugins/woocommerce/9.5.2/includes/data-stores/abstract-wc-order-data-store-cpt.php(434): Abstract_WC_Order_Data_Store_CPT->set_order_props(Object(Automattic\WooCommerce\Admin\Overrides\Order), Array)
#27 /wordpress/plugins/woocommerce/9.5.2/includes/data-stores/class-wc-order-data-store-cpt.php(122): Abstract_WC_Order_Data_Store_CPT->read_order_data(Object(Automattic\WooCommerce\Admin\Overrides\Order), Object(WP_Post))
#28 /wordpress/plugins/woocommerce/9.5.2/includes/data-stores/abstract-wc-order-data-store-cpt.php(159): WC_Order_Data_Store_CPT->read_order_data(Object(Automattic\WooCommerce\Admin\Overrides\Order), Object(WP_Post))
#29 /wordpress/plugins/woocommerce/9.5.2/includes/class-wc-data-store.php(159): Abstract_WC_Order_Data_Store_CPT->read(Object(Automattic\WooCommerce\Admin\Overrides\Order))
#30 /wordpress/plugins/woocommerce/9.5.2/includes/abstracts/abstract-wc-order.php(137): WC_Data_Store->read(Object(Automattic\WooCommerce\Admin\Overrides\Order))
#31 /wordpress/plugins/woocommerce/9.5.2/includes/class-wc-order-factory.php(49): WC_Abstract_Order->__construct(9433)
#32 /wordpress/plugins/woocommerce/9.5.2/includes/wc-order-functions.php(88): WC_Order_Factory::get_order(9433)
#33 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-orders.php(586): wc_get_order(9433)
#34 [internal function]: WCML_Orders::{closure}(9433)
#35 /srv/htdocs/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array(Object(Closure), Array)
#36 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-orders.php(591): WPML\FP\{closure}(9433)
#37 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-emails.php(289): WCML_Orders::getLanguage(9433)
#38 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-emails.php(246): WCML_Emails->get_order_language(9433)
#39 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-emails.php(773): WCML_Emails->refresh_email_lang(9433)
#40 /wordpress/core/6.7.1/wp-includes/class-wp-hook.php(324): WCML_Emails->translate_woocommerce_countries(Array)
#41 /wordpress/core/6.7.1/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#42 /wordpress/plugins/woocommerce/9.5.2/includes/class-wc-countries.php(70): apply_filters('woocommerce_cou...', Array)
#43 /wordpress/plugins/woocommerce/9.5.2/includes/class-wc-countries.php(48): WC_Countries->get_countries()
#44 /wordpress/plugins/woocommerce/9.5.2/includes/class-wc-countries.php(290): WC_Countries->__get('countries')
#45 /wordpress/plugins/woocommerce/9.5.2/includes/wc-core-functions.php(1393): WC_Countries->get_allowed_countries()
#46 /wordpress/plugins/woocommerce/9.5.2/includes/data-stores/class-wc-customer-data-store-session.php(168): wc_get_customer_default_location()
#47 /wordpress/plugins/woocommerce/9.5.2/includes/data-stores/class-wc-customer-data-store-session.php(157): WC_Customer_Data_Store_Session->set_defaults(Object(WC_Customer))
#48 /wordpress/plugins/woocommerce/9.5.2/includes/class-wc-data-store.php(159): WC_Customer_Data_Store_Session->read(Object(WC_Customer))
#49 /wordpress/plugins/woocommerce/9.5.2/includes/class-wc-customer.php(125): WC_Data_Store->read(Object(WC_Customer))
#50 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/classes/multi-currency/geolocation/Geolocation.php(133): WC_Customer->__construct(144146929, true)
#51 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/classes/multi-currency/geolocation/Geolocation.php(92): WCML\MultiCurrency\Geolocation::getUserCountryByAddress('billing')
#52 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/classes/Multicurrency/Resolver/ResolverForModeLocation.php(19): WCML\MultiCurrency\Geolocation::getUserCountry()
#53 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/classes/Multicurrency/Resolver/ResolverForModeLocation.php(24): WCML\MultiCurrency\Resolver\ResolverForModeLocation->WCML\MultiCurrency\Resolver\{closure}('EUR')
#54 /srv/htdocs/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Logic.php(121): WCML\MultiCurrency\Resolver\ResolverForModeLocation->getClientCurrency(NULL)
#55 [internal function]: WPML\FP\Logic::WPML\FP\{closure}(Object(Closure), Array, NULL)
#56 /srv/htdocs/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array(Object(Closure), Array)
#57 [internal function]: WPML\FP\{closure}(NULL)
#58 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/classes/Multicurrency/Resolver/ComposedResolver.php(30): call_user_func(Object(Closure), NULL)
#59 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/inc/currencies/class-wcml-multi-currency.php(462): WCML\MultiCurrency\Resolver\ComposedResolver->getClientCurrency()
#60 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/classes/multi-currency/payment-gateways/class-wcml-currencies-payment-gateways.php(184): WCML_Multi_Currency->get_client_currency()
#61 /srv/htdocs/wp-content/plugins/woocommerce-multilingual/classes/multi-currency/payment-gateways/class-wcml-currencies-payment-gateways.php(107): WCML_Currencies_Payment_Gateways->store_supported_gateways()
#62 /wordpress/core/6.7.1/wp-includes/class-wp-hook.php(324): WCML_Currencies_Payment_Gateways->init_gateways('')
#63 /wordpress/core/6.7.1/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#64 /wordpress/core/6.7.1/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#65 /wordpress/core/6.7.1/wp-settings.php(726): do_action('wp_loaded')
#66 /srv/htdocs/wp-config.php(84): require_once('/wordpress/core...')
#67 /wordpress/core/6.7.1/wp-load.php(55): require_once('/srv/htdocs/wp-...')
#68 /wordpress/core/6.7.1/wp-admin/admin.php(34): require_once('/wordpress/core...')
#69 /wordpress/core/6.7.1/wp-admin/post.php(12): require_once('/wordpress/core...')
#70 {main}
thrown in /wordpress/plugins/woocommerce/9.5.2/includes/wc-core-functions.php on line 1395
jeremyL-22
Ciao Laura,
Non capisco il tuo messaggio. L'errore è descritta in modo chiaro. Ho anche aggiunto lo screenshot spiegando dove è il "workaround" usato per adesso (= quando disattivo la funzionalità WPML "multicurrency" lo bug non si manifesta più.
Ripartiamo:
- quando sto per cliccare "create" nella la parte "new order" di WooCommerce, il sistema torna un critical error (quindi mi è impossibile creare ordine manualmente... Serve quando un cliente mi paga in contenti o con il POS per esempio)
- dopo parlarne con il supporto da WooCommerce hanno diagnosticato che è dovuto al plugin WPML che sta mandando un valore "null" quando dovrebbe essere un valore "array" (format type issue... questo è descritto nel log penso) e che ha da fare con le conversione "WPML multicurrency"
- la palla è adesso nel campo di WPML per dirci se avete un patch o una soluzione
Dimmi se/quando posso riattivare la vostra funzione multicurrency e/o se devo aggiustare qualcosa.
Buon pomeriggio
Jeremy