Skip to content Skip to sidebar

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

Problem:
The client was experiencing an issue where WPML was stuck refreshing the translation status when translating pages built with Elementor.
Solution:
We provided a workaround that involves three possible solutions:
1. Turn off Nested Elements in Elementor features.
2. Modify the

wp-content\plugins\elementor-pro\modules\woocommerce\classes\products-renderer.php

file in the Elementor Pro plugin by replacing a specific line of code:

if ( is_checkout() ) {
	return;
}

with

if ( is_checkout() || ! WC()->cart ) {
	return;
}

3. Install a Must-Use (MU) plugin and add the following code to handle the issue:

<?php

/**
 * Plugin Name: WPML PB 470
 * Description: Fix PHP Fatal error: Uncaught Error: Call to a member function get_cross_sells()
 * Author URI: https://onthegosystems.myjetbrains.com/youtrack/issue/wpmlpb-470
 */

add_filter('wpml_pre_save_pro_translation', function ( $postarr ) {
    if (function_exists('wc_load_cart')) {
        wc_load_cart();
    }

    return $postarr;
});

If the solution provided here is not relevant to your case, because it might be outdated or not applicable, we recommend opening a new support ticket. 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 you need further assistance, please contact us in the WPML support forum.

0% 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.

Tagged: 

This topic contains 15 replies, has 2 voices.

Last updated by Dražen 1 year, 9 months ago.

Assisted by: Dražen.

Author Posts
May 13, 2024 at 7:08 am #15618629

Dražen
Supporter

Languages: English (English )

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

Hello,

please note there is change to workaround, and the one in my last reply will not work.

Workaround
1. Turn off Nested Elements in Elementor features

OR

2. Edit wp-content\plugins\elementor-pro\modules\woocommerce\classes\products-renderer.php on line 249 replace

if ( is_checkout() ) {
						return;
					}

with

if ( is_checkout() || ! WC()->cart ) {
						return;
					}

OR

3. Install MU plugin so the patch will not be overwritten with Elementor updates and add next code:

<?php

/**
 * Plugin Name: WPML PB 470
 * Description: Fix PHP Fatal error: Uncaught Error: Call to a member function get_cross_sells()
 * Author URI: <em><u>hidden link</u></em>
 */

add_filter('wpml_pre_save_pro_translation', function ( $postarr ) {
    if (function_exists('wc_load_cart')) {
        wc_load_cart();
    }

    return $postarr;
});

Regards,
Drazen