Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client was experiencing a fatal error when trying to synchronize attributes and translate products in bulk using WPML and WooCommerce. The error was a TypeError in

wc-attribute-functions.php

indicating that an array was given where a string was expected.

Solution:
We recommended the following troubleshooting steps:
1. Navigate to WPML -> Support -> Troubleshooting and perform the following actions:
- Synchronize posts taxonomies (for products and then for variations)
- Clear the cache in WPML
- Remove ghost entries from the translation tables
- Set language information
- Fix terms count
- Fix post type assignment for translations

If the issue persists, we suggested:
1. Installing the Adminer plugin to investigate the database entries for the problematic product IDs.
2. Checking if the mentioned product IDs are valid and not in a corrupted state.
3. Bulk editing products in WordPress to potentially fix corrupted data.

If these steps do not resolve the issue, we advised the client to open a new support ticket for further assistance. We also highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins.

If the solution provided here is not relevant to your case, either because it's outdated or not applicable, please do not hesitate to open a new support ticket with us for personalized assistance at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Bruno Kos 1 year, 4 months ago.

Assisted by: Bruno Kos.

Author Posts
February 26, 2024 at 9:13 am

janP-48

I already tried to discuss one thing with the support, the synchronization of the attributes fails me on one fatal error, could you give me some advice?

February 26, 2024 at 9:41 am
February 26, 2024 at 4:05 pm #15345290

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Can you install this plugin?
https://wordpress.org/plugins/pexlechris-adminer/

It would seem that this is cause by a post with the ID of 6556, but this doesn't seem to be a product as on hidden link I get "Sorry, you are not allowed to edit posts in this post type".

February 27, 2024 at 7:15 am #15347318

janP-48

I installed the plugin, please.

The problematic product was in the trash, so it could not be accessed, I deleted it, the synchronization then went well, but I still cannot translate the products in bulk.

When trying to bulk translate, for example, 4 products, it displays the following error:

[27-Feb-2024 06:57:43 UTC] PHP Fatal error: Uncaught TypeError: html_entity_decode(): Argument #1 ($string) must be of type string, array given in /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce/includes/wc-attribute-functions.php:19
Stack trace:
#0 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce/includes/wc-attribute-functions.php(19): html_entity_decode(Array, 3, 'UTF-8')
#1 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce/includes/wc-product-functions.php(723): wc_get_text_attributes(Array)
#2 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variation-data-store-cpt.php(83): wc_get_product_variation_attributes(6650)
#3 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce/includes/class-wc-data-store.php(159): WC_Product_Variation_Data_Store_CPT->read(Object(WC_Product_Variation))
#4 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php(138): WC_Data_Store->read(Object(WC_Product_Variation))
#5 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce/includes/class-wc-product-simple.php(24): WC_Product->__construct(6650)
#6 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce/includes/class-wc-product-variation.php(54): WC_Product_Simple->__construct(6650)
#7 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce/includes/class-wc-product-factory.php(46): WC_Product_Variation->__construct(6650, Array)
#8 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce/includes/wc-product-functions.php(73): WC_Product_Factory->get_product(6650, Array)
#9 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-variations-data.php(209): wc_get_product(6650)
#10 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-product-data.php(176): WCML_Synchronize_Variations_Data->sync_product_variations(6340, 6646, 'en', Array)
#11 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-product-data.php(514): WCML_Synchronize_Product_Data->sync_product_data(6340, 6646, 'en')
#12 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/class-wp-hook.php(326): WCML_Synchronize_Product_Data->icl_pro_translation_completed(6646)
#13 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#14 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#15 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/sitepress-multilingual-cms/inc/translation-jobs/helpers/wpml-save-translation-data-action.class.php(303): do_action('icl_pro_transla...', 6646, Array, Object(stdClass))
#16 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/sitepress-multilingual-cms/inc/wpml-private-actions-tm.php(34): WPML_Save_Translation_Data_Action->save_translation()
#17 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/sitepress-multilingual-cms/classes/ATE/class-wpml-tm-ate-jobs.php(90): wpml_tm_save_data(Array, false)
#18 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/sitepress-multilingual-cms/API/ATE.php(54): WPML_TM_ATE_Jobs->apply('<?xml version="...')
#19 [internal function]: WPML\TM\API\ATE->applyTranslation('84', '6340', 'hidden link...')
#20 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array(Array, Array)
#21 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Maybe.php(106): WPML\FP\{closure}('hidden link...')
#22 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Functor/Applicative.php(13): WPML\FP\Just->map(Object(Closure))
#23 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Fns.php(383): WPML\FP\Just->ap(Object(WPML\FP\Just))
#24 [internal function]: WPML\FP\Fns::WPML\FP\{closure}(Object(Closure), Object(WPML\FP\Just), Object(WPML\FP\Just), Object(WPML\FP\Just))
#25 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array(Object(Closure), Array)
#26 [internal function]: WPML\FP\{closure}(Object(WPML\FP\Just), Object(WPML\FP\Just), Object(WPML\FP\Just))
#27 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Fns.php(150): call_user_func_array(Object(Closure), Array)
#28 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Maybe.php(144): WPML\FP\Fns::WPML\FP\{closure}(Object(stdClass))
#29 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/sitepress-multilingual-cms/classes/ATE/REST/PublicReceive.php(84): WPML\FP\Just->chain(Object(Closure))
#30 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/rest-api/class-wp-rest-server.php(1193): WPML\TM\ATE\REST\PublicReceive->receive_ate_job(Object(WP_REST_Request))
#31 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/rest-api/class-wp-rest-server.php(1041): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wpml/tm/v1/ate...', Array, NULL)
#32 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/rest-api/class-wp-rest-server.php(431): WP_REST_Server->dispatch(Object(WP_REST_Request))
#33 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/rest-api.php(424): WP_REST_Server->serve_request('/wpml/tm/v1/ate...')
#34 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/class-wp-hook.php(324): rest_api_loaded(Object(WP))
#35 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#36 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#37 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/class-wp.php(418): do_action_ref_array('parse_request', Array)
#38 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/class-wp.php(813): WP->parse_request('')
#39 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-includes/functions.php(1336): WP->main('')
#40 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-blog-header.php(16): wp()
#41 /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/index.php(17): require('/data/2/e/2e35f...')
#42 {main}
thrown in /data/2/e/2e35f540-36be-456e-b7c4-e20a9adeeb4b/aditbe.com/web/wp-content/plugins/woocommerce/includes/wc-attribute-functions.php on line 19

page: hidden link

The products then get into the "queue" - hidden link and remain there until I make a "resave" for the given product in the basic language.

We need to translate the products in bulk, could you help me with that? Could you try translating multiple products at once via "Translation Management"?

February 27, 2024 at 8:34 am #15347628

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

The error log mentions a product ID. It appears in several lines of the stack trace, specifically:

- Line 6: `WC_Product_Simple->__construct(6650)`
- Line 7: `WC_Product_Variation->__construct(6650, Array)`
- Line 8: `WC_Product_Factory->get_product(6650, Array)`
- Line 9: `wc_get_product(6650)`
- Line 10: `WCML_Synchronize_Variations_Data->sync_product_variations(6340, 6646, 'en', Array)`
- Line 11: `WCML_Synchronize_Product_Data->sync_product_data(6340, 6646, 'en')`
- Line 12: `icl_pro_translation_completed(6646)`

These lines suggest that the error is related to product IDs 6650, 6340, and 6646 in the context of product synchronization, translation, and completion.

Can you check one of these see if these are also valid? Perhaps they ended up in the same state as the one we had before, thereby preventing translation.

February 27, 2024 at 1:00 pm #15349196

janP-48

We wanted to bulk translate these IDs via "translation management". As soon as I did a "resave" of the products in the default language, it helped. However, we would like to figure out why it makes errors, because we want to translate in bulk.

Could you try translating multiple products at once via "Translation Management"?

February 27, 2024 at 2:14 pm #15349498

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

We tried troubleshooting steps in WPML but as these didn't resolve the issue due to corrupt data in product originals, saving the products in their original form is likely necessary to correct this and the only way to find out which are these, we need new logs again.

You can try bulk editing products in WordPress also as that may fix corrupted data though:

1. Go to **Products > All Products** in the dashboard.
2. Select products, choose **Edit** from **Bulk Actions**, then **Apply**.
3. Edit the required fields in bulk.