Error: "TypeError: $w(...).getProduct is not a function"

Hello everyone,
I made ratings and reviews by this tutorial: , but I get an error in code when I go to the preview page.

TypeError: $w(...).getProduct is not a function

My code

$w.onReady(async function () {
// Set the global product variable to the currently displayed product.
product = await $w('#productPage1').getProduct();
// Load the current product's reviews using the initReviews() function.

What could be the problem?

Hi! Please make sure that the element IDs in your code match the ones on your page. In addition, are you inserting this code to a default product page? Or do you have custom dynamic pages to display products?

I apologize for the confusion. We are aware of this issue and have forwarded your information to the relevant department.
Could you please send us your site and Editor link for further investigation?

I am also facing the same problem.

I have defult product page, IDs is correct.

The issue was fixed and the error should no longer appear.
Please contact Wix support if it occurs again.

1 Like

Yes, code error was fixed, but reviews still do not working.

I am getting this same error: $w(ā€¦).getProduct is not a function
Is there any fix to try myself? Having a hard time contacting Wix support, assuming they are overwhelmed with all the COVID-19 craziness.

Iā€™m trying to access the product details from the corresponding Product Page so I can check if the product is in stock. I want to dynamically show an email collection form when the product is out of stock.