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

Last updated by Itamar 1 month, 4 weeks ago.

Assigned support staff: Itamar.

Author Posts
August 8, 2019 at 7:51 am #4360519

Xavier

Hello, I have detected that some products generate this error:

Fatal error: Uncaught Error: Call to a member function get_id() on bool in //wp-content/plugins/woocommerce/includes/class-wc-comments.php:390
Stack trace:
#0 //wp-content/plugins/woocommerce-multilingual/inc/class-wcml-comments.php(77): WC_Comments::get_rating_counts_for_product(false)
#1 //wp-content/plugins/woocommerce-multilingual/inc/class-wcml-comments.php(259): WCML_Comments->recalculate_comment_rating(33703)
#2 //wp-content/plugins/woocommerce-multilingual/inc/class-wcml-comments.php(183): WCML_Comments->get_reviews_count('all')
#3 //wp-includes/class-wp-hook.php(286): WCML_Comments->comments_link('')
#4 //wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array)
#5 //wp-includes/plugin.php(465): WP_Hook->do_action(Array)
#6 //wp-includes/comment-template.php in //wp-content/plugins/woocommerce/includes/class-wc-comments.php on line 390

I have debugged it and the error goes away when I disable "Enable reviews", but also when I disable WPML Translation Manager. The most strange is that it only generates this error on some products and I can't find the reason.

Thank you.

August 8, 2019 at 8:25 am #4360925

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

Thank you for contacting WPML support.

1. go to WPML > WooCommerce Multilingual > Status : hidden link
2. scroll down to the very bottom and click on troubleshooting
3. and, perform all these: hidden link

Then check the issue.

Let me know how it goes.

Regards,
Riffaz.

August 8, 2019 at 9:32 am #4361481

Xavier

I run all of them but the problem persists.

August 11, 2019 at 6:25 am #4376603

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

Let me now your site login details to check this.
The next reply is private.

Also, let me know how to check this and let me know some products URLs where we can see this issue.

Regards,

August 13, 2019 at 5:32 pm #4390081

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

Riffaz is not available today so I'll continue to handle this ticket. I hope that it is alright with you.

Thanks for the access details.
Can you please tell me where and how can I see this issue on your site?
Which products show this error?

Thanks,
Itamar.

August 14, 2019 at 6:09 am #4392591

Xavier

Thanks for your help.

Please open my previous private message. You will find a link of a page single product page that is generating the error. You can see that the footer is not being loaded.

August 14, 2019 at 8:49 pm #4397495

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi and thanks for the extra details.

I'll be able to reply here early next week.

Thank you for your patience.
Itamar.

August 19, 2019 at 9:58 am #4415009

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

I can see the issue on your site when trying to add a product review. I can also see that next to the 'Show comments' there is a spin icon that spins all the time, but there is no error on the console.

I'm currently consulting our second tier supporters about this issue. Meanwhile, I would like to ask you to perform the following procedure. I suspect that there is a collision with the theme or another plugin that might cause this problem. If possible get your site into a minimum environment. Minimum environment means switching to a default WordPress theme like TwentyNineteen and no plugins activated except WPML.
Is it possible for you to try it?
You will need first to check if the problem persists when just the theme is switched to TwentyNineteen (for example). If it persists then deactivate all plugins except the WPML and its add-ons and WooCommerce itself. Then please check if the problem persists. If it does not persist so start by activating the plugins one by one and check when the problem comes back, then report to me which was the culprit plugin.

**** Important! Please make a full site backup (files and DB) before you proceed with those steps****


*** If your site is a live site you might want first to try those procedures in a staging environment or a snapshot of your site on your local server or another server. ***

Thanks,
Itamar.

August 20, 2019 at 8:09 am #4421505

Xavier

Yes, please. Disable all plugins that you need. This is only a stage site, not a production site. So you can make as many tests as you need.

Thanks!

August 20, 2019 at 2:24 pm #4424343

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

I've found out that the product's review issue is not related to WPML or any of its add-ons. It seems to be related to the theme that you are using, the 'Fanatic Guitars' theme. Here is how I've checked this.
1. I've switched the theme to the 'Storefront' theme.
2. I deactivated WPML and its add-ons.
3. I've tried to add a product review in the 'ESP LTD EC-10 Guitarra Eléctrica (incluye funda)' product. And everything is working fine. Not as before, I can add a review, and I can also see the previous reviews. Please see the attached screenshot. And in the debug.log, I'm not getting the Uncaught Error: Call to a member function get_id() error.

I've left your site with the Storefront theme active and WPML plugins deactivated. Please check things and confirm that you see that the theme causes the issue.

Thanks,
Itamar.

August 22, 2019 at 9:57 am #4438217

Xavier

I switched to my theme and it also works now. So I have created a new stage site cloning my live site. Afterwards I switched to Storefront and I get the same error. What else did you do that could have fixed it?

August 24, 2019 at 7:27 pm #4452211

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

As far as I can remember, I've shared with you everything.
Is the issue on the staging site happening when WPML is active or not active?

August 26, 2019 at 8:20 am #4456751

Xavier

What I have found out is that this instead of returning $product as an object, this specific product returns $object as a string. That generates error on my template + WPML. As this is requesting to much time to investigate, I have decided to delete the product. Thank you

August 26, 2019 at 6:51 pm #4460909

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

You are welcome.

I'm closing this ticket now.

Best Regards,
Itamar.