Skip Navigation

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

Problem:
After updating WPML and other plugins, a critical error occurs on some WooCommerce product pages when the WPML String Translation plugin is active. Deactivating the plugin resolves the issue temporarily.
Solution:
To permanently fix the issue, modify the code in two files:
1. Navigate to

/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/DataConvert.php

and replace the unserializeString function with the following code:

private static function unserializeString( $string, $associative ) {<br />    // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize<br />    $value = is_serialized( $string ) ? unserialize( $string ) : json_decode( $string, $associative );<br />    if ($value === null){<br />        return $string;<br />    }<br />    return $value;<br />}

2. Go to

/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/QueryFilter.php

and replace the translateQueryIds function with:

public function translateQueryIds( $value, $object_id, $meta_key, $single ) {<br />    if ( WPML_Elementor_Data_Settings::META_KEY_DATA === $meta_key && $single ) {<br />        $value = get_post_meta( $object_id, WPML_Elementor_Data_Settings::META_KEY_DATA, true );<br />        if ( $value ) {<br />            $value = DataConvert::unserialize( $value, false );<br />            $value = this->recursivelyTranslateQueryIds( $value );<br />            if (is_array($value)) {<br />                $value = DataConvert::serialize($value, false);<br />            }<br />        }<br />    }<br /><br />    return $value;<br />}

After making these changes, save the files. This solution was successfully applied to a staging site, resolving the issue.

Please note that this solution might be outdated or not applicable to your specific case. If the problem persists, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If needed, do not hesitate to open a new support ticket.

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 26 replies, has 0 voices.

Last updated by Carlos Rojas 1 month, 2 weeks ago.

Assisted by: Carlos Rojas.

Author Posts
May 8, 2025 at 9:01 am #17010378

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

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

Thank you very much for creating the staging site.

I ran several troubleshooting steps, but the issue persists. For this reason,n I have escalated this ticket to our 2nd tier of support, where our 2nd tier specialists will take a deeper look and isolate the cause.

I will keep you updated on the evolution of this ticket.
Thank you very much for your patience and understanding!

May 8, 2025 at 10:12 am #17010789

marikaK

Ok, thanks, Carlos! Will wait update on this issue!

May 8, 2025 at 10:17 am #17010814

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

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

Thank you very much.

May 8, 2025 at 12:43 pm #17011747

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

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

Hi again,

Could you tell me if these products, the ones with the error, were imported?

Also, does the issue persists if you create a new product?

May 8, 2025 at 1:05 pm #17011901

marikaK

Yes, those products were imported (year ago), but everything worked perfectly till last update. And there are still some products which was imported as well and they are working (for example screenshot from one subcategory attached - everything was imported together, but 2 of those products are working fine)

And with new product - seems there is no problem.

wpml-working-not-working.png
May 8, 2025 at 1:07 pm #17011933

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

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

1.- Is there any different structure or element used in the products that are showing the error, compared to the ones that are working fine?

2.- Does the issue persist if you create a new product?

May 9, 2025 at 5:16 am #17014437

marikaK

1. Structure is almost the same. In products, which are not working, there are 2 different type attributes (izvada tips and līmeņrādis) and a bit different description. Tried to delete them - issue persists. So I tried to delete elements one by one and deleted pictures as well - still the same even there is just the product title and the category.

2.If I make a new product in the same category - no problem.

3. If I copy existing product, which is not working- still the same (even if I delete all the information, leaving just product title and category). I tried to change copied products category - problem persists.
But if I copy exiting product, which is working - there are no problems at all.

May 9, 2025 at 6:08 am #17014587

ioannisa

I have the same fatal error. Please fix it asap

May 9, 2025 at 8:57 am #17015315

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

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

Thank you very much for your feedback. I have updated our 2nd-tier specialists with this new information so they can take a deeper look.


@ioannisa please wait for an answer in this ticket and if necessary, open a new one.

May 9, 2025 at 1:59 pm #17017027

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

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

Hi there,

Please add these changes to the code to solve the problem:
- Go to /wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/DataConvert.php and overwrite the current unserializeString function to:

	private static function unserializeString( $string, $associative ) {
		// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize
		$value = is_serialized( $string ) ? unserialize( $string ) : json_decode( $string, $associative );
		if ($value === null){
			return $string;
		}
		return $value;
	}

- Go to /wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/QueryFilter.php and overrwrite the current translateQueryIds function to:

public function translateQueryIds( $value, $object_id, $meta_key, $single ) {
		if ( WPML_Elementor_Data_Settings::META_KEY_DATA === $meta_key && $single ) {
			$value = get_post_meta( $object_id, WPML_Elementor_Data_Settings::META_KEY_DATA, true );
			if ( $value ) {
				$value = DataConvert::unserialize( $value, false );
				$value = $this->recursivelyTranslateQueryIds( $value );
                if (is_array($value)) {
                    $value = DataConvert::serialize($value, false);
                }
			}
		}

		return $value;
	}

-Save the changes

I have applied the same changes to the staging site and now you can see that the issue is solved and the product is shown correctly on the frontend.

May 10, 2025 at 6:54 am #17018496

marikaK

Hello, Carlos!

Copied code, which You gave me in previous answer. It messed up all site... But as You said, that in staging site You have added this code and everything works, copied code from there and everything is working fine now! Hope the problem is solved and won't reappear!

Thanks a lot! 🙂

WEBSITE-after-code.JPG
May 12, 2025 at 8:32 am #17021502

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

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

Excellent!

Please don't hesitate to contact us if you need our help in the future with WPML.
Have a great day!