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

Hello everyone,
I made ratings and reviews by this tutorial: https://support.wix.com/en/article/corvid-tutorial-adding-ratings-and-reviews-to-a-wix-stores-site , 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.
initReviews();
});

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. https://www.wix.com/corvid/forum/community-discussion/getproduct-is-not-a-function/p-1/dl-5e53d1637c917300172be09e

I have defult product page, IDs is correct. https://editor.wix.com/html/editor/web/renderer/edit/08e2fd48-c8e2-481d-8348-248661326aff
https://essetdigital.wixsite.com/mysite/

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.