Replies: 0
Hello,
I have this :
– WordPress 5.8.3
– WooCommerce 6.0.0
– WooCommerce Multilinggual 4.12.1
– WPML Multilingual CMS 4.4.12
– Advanced Custom Fields PRO 5.11.4
– Advanced Custom Fields Multilingual 1.9.3
– PHP 8.0.3
I try to translate a WooCommerce product using WooCommerce Multilingual editor.
It works great for most product, but I have the following error on vriable products :
Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, string given in /website_path/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-editor-ui-product-job.php on line 606
After looking in plugin code trying to debug, I found this :
– The error is triggerred when calling $this->add_custom_field_to_element_data() on variations.
– “add_custom_field_to_element_data” function loop through custom fields, and the error is triggered for a custom field created with ACF. This field is not set for the variations, it’s only editable on product page, but not specifically for each variation. Is it a problem ? I would like to keep it like this
– At this point, check_custom_field_is_single_value() return false because get_custom_field_values() return an empty array. All of this because the get_post_meta() is called with the variation id and the variation does not have a value for the custom field (see previous point)
It worked before but with hidden PHP warnings on the production website. We recently updated PHP version to PHP 8 and the array_filter error is now a Fatal Error.
Any solution that can help ? Is there a way to avoid WCML looping through some field for variations or something ?
Kind regards,
Valentin – Concept Image