Skip to content Skip to sidebar

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

Problem:
If you're experiencing issues with your WooCommerce product detail pages becoming empty when using many variations (e.g., 108 variations) in combination with the WPML String Translations plugin, this might be due to a regular-expression breaking silently related to CSS classes. This issue can cause the page to display only the header and footer.

Solution:
We recommend taking the following steps to resolve this issue:
1. Ensure you back up your website and database completely before making any changes.
2. Navigate to

/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/class-wpml-elementor-adjust-global-widget-id.php

.
3. Find the function

duplicate_css_class_with_original_id

starting from line 132.
4. Replace the existing function with the following code:

public function duplicate_css_class_with_original_id( $content ) {
    $classPrefixes = wpml_collect( [
        'elementor-',
        'elementor-global-',
    ] )->implode( '|' );

    if ( mb_strlen( $content) < 300000 ) {
        return preg_replace_callback( '/(class=".*(\' . $classPrefixes . '\'))(\d+)/', array( $this, 'convert_id_to_original' ), $content );
    }

    return $content;
}

5. Save the changes and recheck the functionality.

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we 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 problems persist, please open a new support ticket.

100% of people find this useful.

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.

This topic contains 24 replies, has 0 voices.

Last updated by Waqas Bin Hasan 7 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
September 11, 2025 at 9:53 am #17393543

Philip

Thanks for your assistance!

- Update Elementor Pro with a license so I can edit and check the related templates. Currently it seems to not load properly.
The license should be activated now.

- Which template and elementor widget(s) are being used for this part of the product detail? As per my understanding it is "Produkt Detail" template, right?
Yes, that is correct.

- Try without some advanced or pro elements, like a simple base template or even without a template to create a product detail page (also showing variations), and see if it works?
I'm not sure how to do that since product title, price, image are elementor pro items, and necessary for the product detail page...

September 11, 2025 at 1:00 pm #17394431

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates.

I'll check again and 'll get back to you accordingly (by tomorrow).

September 12, 2025 at 5:48 am #17396075

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation, I checked again in your site and so far no luck. So I need to escalate the matter for further investigation.

However, before that, I also created this fresh sandbox site (hidden link - one-click login) with all the necessary plugins and WPML setup as per your staging site.

Can you please try to reproduce the issue here? You'll need to add a sample product, add variations, apply swatches, create the required product page and template with Elementor and translate these.

Elementor is also registered in this sandbox, so you can have all the pro features available.

Please let me know when you're ready.

September 12, 2025 at 8:14 am #17396609

Philip

I have added a product with 100 variations, which normally crashed my product detail page. Somehow on your sandbox that does not happen.

I exported the template from the staging site, and imported it on the sandbox site.

I tried adding a translated version as well, but I'm having some trouble with that. Product title, image, swatches,... don't show up correctly. Maybe you can help me out there?

Thanks for the support!

September 12, 2025 at 11:50 am #17397417

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for setting up in the sandbox. I translated the product (hidden link) and swatches seem to work fine (regardless the images of swatches). At least the variations appear fine in both languages (default and translated).

And there's no apparent error or issue as well.

So I believe this is something to do with your setup. I'll need to take a backup of your staging site, to escalate it for further investigation. Please feel free to remove any data or content you don't want to share, while leaving currently active plugins/theme in place (as well as the problematic product and stuff). And please also confirm if it is OK to take a backup of the staging site for escalation?

P.S.: I'll be off over the weekend and 'll be able to attend on Monday.

September 12, 2025 at 12:25 pm #17397498

Philip

Thank you very much. Yes you may create a Backup of the staging site, and just let me know if I can assist you in any way.

Thank you and have a nice weekend!

September 15, 2025 at 7:21 am #17400829

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

I've escalated the issue to our 2nd tier team by taking a backup of your site. I'll update you as soon as there's more to it.

Please note that, the overall package size was more than 3GB, so I did the following:

- Created a complete backup which can be found in All-in-One WP Migration -> Backups -> stage-feinfuerklein-com-20250915-084301-nqesj39iyz5l.wpress file.
- Then removed inactive plugins and themes.
- Created another backup, excluding media, size 388.53 MB, which I used to escalate.

September 23, 2025 at 7:37 am #17423715

Philip

Hello,

I hope you’re doing well. I just wanted to kindly follow up regarding the issue I escalated last week. Could you please let me know if there are any updates on the progress or next steps?

Thank you for your time and support!

September 24, 2025 at 5:52 am #17427416

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Our apologies for the delay but unfortunately our team is still working on this and trying their best to find out the root cause. Generally there're no errors being thrown which are usually helpful in finding the underlying reason of an issue. But in this case, logs are silent and code related to Variation Swatches is intertwined.

I've just checked again with the team and 'll update you as soon as there's some progress.

September 25, 2025 at 5:46 am #17430554

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

Our team was able to locate the issue which is happening due to a regular-expression breaking silently when there's a very large content. The code relates to CSS classes, so as a precaution you should be on the lookout for if there are styling problems when changing language.

For now, team proposes following workaround:

IMPORTANT: Please take full backup of your website and database beforehand. 

1. Edit /wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/class-wpml-elementor-adjust-global-widget-id.php file.

2. Locate the function duplicate_css_class_with_original_id from line 132.

3. Replace the existing code with this:

	public function duplicate_css_class_with_original_id( $content ) {

		$classPrefixes = wpml_collect( [
			'elementor-',
			'elementor-global-',
		] )->implode( '|' );

		if ( mb_strlen( $content) < 300000 ) {
			return preg_replace_callback( '/(class=".*(' . $classPrefixes . '))(\d+)/', array( $this, 'convert_id_to_original' ), $content );
		}

		return $content;
	}

4. Save and recheck.

I've applied this in your staging site and this seems to fix the said problem (hidden link).

Please check and confirm, thanks again.