Skip Navigation

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

Problem:
The client was encountering a critical error in the WooCommerce orders panel after updating to RC 5.4.0-rc.1. The error, 'Call to a member function get_title() on bool', occurred due to the WooCommerce Multilingual plugin not finding a specific shipping method, causing the function

WC_Shipping_Zones::get_shipping_method($shippingInstanceId)

to return false.
Solution:
We recommended the following steps:
1. Ensure you have a backup of your site.
2. Deactivate all plugins except for WPML and WooCommerce, and switch to a default WordPress theme to check if the issue persists.
3. If the problem continues, create a staging site and provide us with admin access for further investigation.
4. As a temporary workaround, modify the file

wp-content/plugins/woocommerce-multilingual/classes/OrderItems/Shipping/ShippingMethod.php

. After the line:

$shippingMethod = \WC_Shipping_Zones::get_shipping_method($shippingInstanceId);

Add the following code:

if ($shippingMethod === false){<br />    return;<br />}

This change prevents the error by stopping the function execution if the shipping method is not found.

If this solution does not resolve your issue, or if it seems outdated or irrelevant to your case, please visit our support forum to open a new 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.

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

Last updated by Dražen 1 week, 2 days ago.

Assisted by: Dražen.

Author Posts
January 26, 2025 at 2:24 pm #16635257

davidB-295

Background of the issue:
I was trying to access the orders list after updating to the RC 5.4.0-rc.1 update. The issue is caused by the woocommerce-multilingual plugin. Here is the error trace: An error of type E_ERROR was caused in line 52 of the file /home/html/adm.dental/_sub/beta/wp-content/plugins/woocommerce-multilingual/classes/OrderItems/Shipping/ShippingMethod.php. Error message: Uncaught Error: Call to a member function get_title() on bool in /home/html/adm.dental/_sub/beta/wp-content/plugins/woocommerce-multilingual/classes/OrderItems/Shipping/ShippingMethod.php:52. It seems that it is caused by this code: $shippingMethod = WC_Shipping_Zones::get_shipping_method( $shippingInstanceId ); if ( $shippingTitle === $shippingMethod->get_title() ) { $item->set_method_title( $this->woocommerce_wpml->shipping->translate_shipping_method_title( $shippingTitle, $shippingId . $shippingInstanceId, $targetLanguage ) ); return; } get_shipping_method( $shippingInstanceId ); returns false, because it did not found the shipping method as described here: hidden link::get_shipping_method. Link to a page where the issue can be seen: hidden link

Symptoms:
I encountered a critical error in the orders panel, specifically a 'Call to a member function get_title() on bool' fatal error. I expected to see a list of orders but only saw the first two orders, then half of #2277 where the error occurred.

Questions:

January 27, 2025 at 7:12 am #16635980

Dražen
Supporter

Languages: English (English )

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

Hello,

thanks for contacting us.

1) Can you please try next:

- Make sure you have a backup.
- Disable all other plugins and leave active only WPML plugins and Wocommerce
- Switch to WP default theme
- Check if the issue still happens.

2) If the issue still happens, please create a staging site and share admin access with us so we can further check and escalate this issue. Note we might need to take a copy of your site, let me know if that is not okay.

Regards,
Drazen

January 31, 2025 at 1:47 pm #16655906

Dražen
Supporter

Languages: English (English )

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

Hello,

thanks for sharing the details.

I checked and I see the issue is not happening when I disable WCML, and also see there is a shipping method "PPL na adresu".

How is this being added or how can I edit it? I can not seem to find it inside the Wocommerce settings.

Regards,
Drazen

February 2, 2025 at 3:59 pm #16660269

davidB-295

Yes, the issue is caused by WCML. “PPL na adresu” is a shipping method included in the PPL plugin. Once you activate the plugin, you can configure this method in WooCommerce shipping settings: hidden link

February 3, 2025 at 7:07 am #16661100

Dražen
Supporter

Languages: English (English )

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

Hello,

thanks.

I have escalated this to our 2nd tier for further check.

I will update you soon.

Regards,
Drazen

February 3, 2025 at 9:39 am #16661924

Dražen
Supporter

Languages: English (English )

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

Hello,

it escalated to our developers for a further fix, a a workaround please use next:

- in the file: wp-content/plugins/woocommerce-multilingual/classes/OrderItems/Shipping/ShippingMethod.php find

		$shippingMethod = \WC_Shipping_Zones::get_shipping_method( $shippingInstanceId );

add this after it:

		if ($shippingMethod === false ){
			return;
		}

Regards,
Drazen