# .getProduct() is not a function

**URL:** <https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348>\
**Category:** Ask the community\
**Tags:** code, question, wix-stores\
**Created:** [February 20, 2020, 10:29pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348 "2020-02-20T22:29:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![sounavmaikap](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@sounavmaikap](https://forum.wixstudio.com/u/sounavmaikap)\
**Post date:** [February 20, 2020, 10:29pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/1 "2020-02-20T22:29:23Z")

</div>

The code which was working fine a week back is broken at the above query.

Background:  
I have built a store page with an extended product page with extended features and options.

```javascript
$w.onReady(async() => {
    product = await $w('#productPage1').getProduct();
    //$w('#imagePreviewHorizontal').src = product.imagekey;
    console.log('product =>', product);
    $w('#boxHorizontal').show();
    $w('#boxVertical').hide();
    loadInitInfo();
    generateRatings();
    for (var type in radio_options){
        $w(radio_options[type]).disable();
    }
    load_inits();
    $w('#repeaterDataset').setFilter(wixData.filter()
        .eq('products', product._id)
    );
    if ($w('#repeaterDataset').getTotalCount() < 1){
        $w('#repeater1').collapse();
        $w('#loadMoreReviews').hide();
    }
});

```

Anybody encountered this recently?

![](https://us1.discourse-cdn.com/wix/original/3X/e/f/ef17de6041198431806018027d53585b8a65cce4.png)

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [February 21, 2020, 2:11am UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/2 "2020-02-21T02:11:04Z")

</div>

Did you create your own ratings and reviews for Wix Stores similar to this Wix tutorial here?  
[https://support.wix.com/en/article/corvid-tutorial-adding-ratings-and-reviews-to-a-wix-stores-site](https://support.wix.com/en/article/corvid-tutorial-adding-ratings-and-reviews-to-a-wix-stores-site)

As note in that tutorial…

There are two ways to filter a dataset: using code (as in this example) or via the [Dataset Settings](https://support.wix.com/en/article/filtering-and-sorting-datasets) panel of the dataset.

```javascript
async function initReviews() {
await $w('#Reviews').setFilter(wixData.filter().eq('productId', product._id));
showReviews();
loadStatistics();
}

```

Line 2: Chain an eq function to setFilter to filter out all items in the Reviews dataset where the product ID doesn’t match the ID of the currently displayed product.

If you want to use this exact scenario and code in your site, you may need to modify these items to match the ones on your site:

- #Reviews

- productId

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [February 21, 2020, 2:19am UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/3 "2020-02-21T02:19:42Z")

</div>

Also, just to make sure that you do have the required imports and the let at the top of your code as mentioned in the tutorial too.

Plus, try changing your code back to how it was written in the tutorial as $w.onReady(async function () { instead of writing it like you have as $w.onReady( **async** () =\> { - just covering all bases here as it should not matter.

```javascript
import wixData from 'wix-data';
import wixWindow from 'wix-window';

let product;   

$w.onReady(async function () {
product = await $w('#productPage1').getProduct();
initReviews();
});

```

Lines 1-2: Import the modules we need to work with Wix Data and Wix Window libraries.  
Line 5: Define the global product variable.  
Line 7: When the page loads, do the following:  
Line 8: Using the getProduct function on the current product page, set the product variable to the currently displayed product.  
Line 9: Run the initReviews function to load the current product’s ratings and reviews.

---

<div class="post-metadata">

**Author:** ![sounavmaikap](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@sounavmaikap](https://forum.wixstudio.com/u/sounavmaikap)\
**Post date:** [February 21, 2020, 5:13am UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/4 "2020-02-21T05:13:48Z")

</div>

Thanks for the quick reply. No - the review and rating does not follow the mentioned tutorial. My program is breaking in the first line of onReady -  
product = **await** $w(‘#productPage1’).getProduct();  
which was working as it is few days back.

---

<div class="post-metadata">

**Author:** ![krupats](https://avatars.discourse-cdn.com/v4/letter/k/a6a055/32.png) [@krupats](https://forum.wixstudio.com/u/krupats)\
**Post date:** [February 24, 2020, 10:23am UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/5 "2020-02-24T10:23:21Z")

</div>

I am getting the same error in my code too. I am new to corvid and wix . I was trying few things for my new website. The get.product function was working perfectly on Feb 18 2020. But not working today. No change was made . I tried restoring site to the older version and tried coding again . I get the same error. Please advise  
Here is the code  
$w(‘#productPage1’).getProduct()  
.then( (product) =\> {  
ProductVariant(product.\_id,VariantDays())  
.then((variants)=\>{

$w(‘#DailyRate’).text=variants.items[0].variant.formattedPrice;  
**if** (variants.items[1].variant.visible === **true** && variants.items[1].variant.price \> 0) {  
$w(‘#WeeklyRate’).text=variants.items[1].variant.formattedPrice;

}  
**if** (variants.items[2].variant.visible === **true** && variants.items[2].variant.price \> 0) {  
$w(‘#MonthlyRate’).text=variants.items[2].variant.formattedPrice;

}

});

});

---

<div class="post-metadata">

**Author:** ![sounavmaikap](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@sounavmaikap](https://forum.wixstudio.com/u/sounavmaikap)\
**Post date:** [February 24, 2020, 1:25pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/6 "2020-02-24T13:25:02Z")

</div>

This is now a BLOCKER for me. Not sure how to reach out to the WIX guys, to register a valid bug. Not able to update my site (premium service) with new content unless this is resolved.

---

<div class="post-metadata">

**Author:** ![Shan](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/shan/32/106059_2.png) [@Shan](https://forum.wixstudio.com/u/Shan)\
**Post date:** [February 24, 2020, 1:36pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/7 "2020-02-24T13:36:35Z")

</div>

This is a known issue. Check [this comment](https://www.wix.com/corvid/forum/main/comment/5e53b74c8ae11200172900c2) .

---

<div class="post-metadata">

**Author:** ![sounavmaikap](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@sounavmaikap](https://forum.wixstudio.com/u/sounavmaikap)\
**Post date:** [February 24, 2020, 2:10pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/8 "2020-02-24T14:10:46Z")

</div>

Thanks Shan

---

<div class="post-metadata">

**Author:** ![anhelinak](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/anhelinak/32/3202_2.png) [@anhelinak](https://forum.wixstudio.com/u/anhelinak)\
**Post date:** [February 25, 2020, 10:05am UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/9 "2020-02-25T10:05:39Z")

</div>

Hi! Please send us your site and Editor link for further investigation

---

<div class="post-metadata">

**Author:** ![sounavmaikap](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@sounavmaikap](https://forum.wixstudio.com/u/sounavmaikap)\
**Post date:** [February 25, 2020, 10:48am UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/10 "2020-02-25T10:48:10Z")

</div>

Thanks Angelina.  
[https://editor.wix.com/html/editor/web/renderer/edit/42cdaf1a-b4b1-4f2f-b75a-279a4b1ad86c?metaSiteId=c641d8f3-b99d-40da-bec3-0474961721e0&editorSessionId=73237f19-84c9-428b-93b8-767685acbeec&referralInfo=dashboard](https://editor.wix.com/html/editor/web/renderer/edit/42cdaf1a-b4b1-4f2f-b75a-279a4b1ad86c?metaSiteId=c641d8f3-b99d-40da-bec3-0474961721e0&editorSessionId=73237f19-84c9-428b-93b8-767685acbeec&referralInfo=dashboard)

---

<div class="post-metadata">

**Author:** ![aleksf](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/aleksf/32/5080_2.png) [@aleksf](https://forum.wixstudio.com/u/aleksf)\
**Post date:** [February 25, 2020, 12:04pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/11 "2020-02-25T12:04:11Z")

</div>

Hi,  
I see that the issue was fixed and the error should no longer occur.

Please let the Wix support know if it occurs again.

---

<div class="post-metadata">

**Author:** ![sounavmaikap](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@sounavmaikap](https://forum.wixstudio.com/u/sounavmaikap)\
**Post date:** [February 25, 2020, 1:54pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/12 "2020-02-25T13:54:32Z")

</div>

Just Tested. Fixed. Thanks heaps

---

<div class="post-metadata">

**Author:** ![juny929](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/juny929/32/5955_2.png) [@juny929](https://forum.wixstudio.com/u/juny929)\
**Post date:** [March 25, 2020, 1:19pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/13 "2020-03-25T13:19:12Z")

</div>

I have the issue while following the tutorial: [https://support.wix.com/en/article/corvid-tutorial-adding-ratings-and-reviews-to-a-wix-stores-site](https://support.wix.com/en/article/corvid-tutorial-adding-ratings-and-reviews-to-a-wix-stores-site)

I am using default product page and checked the ID is correct.  
However, I still get .getProduct() is not a function

---

<div class="post-metadata">

**Author:** ![cotswolddogboutique](https://avatars.discourse-cdn.com/v4/letter/c/e19b73/32.png) [@cotswolddogboutique](https://forum.wixstudio.com/u/cotswolddogboutique)\
**Post date:** [March 25, 2020, 5:14pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/14 "2020-03-25T17:14:02Z")

</div>

I am also still getting the error

I am using default product page and checked the ID is correct.  
However, I still get .getProduct() is not a function

---

<div class="post-metadata">

**Author:** ![juny929](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/juny929/32/5955_2.png) [@juny929](https://forum.wixstudio.com/u/juny929)\
**Post date:** [March 25, 2020, 5:21pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/15 "2020-03-25T17:21:32Z")

</div>

@cotswolddogboutique I published the website, then the function works fine. Only the editor doesn’t detect it…

---

<div class="post-metadata">

**Author:** ![cotswolddogboutique](https://avatars.discourse-cdn.com/v4/letter/c/e19b73/32.png) [@cotswolddogboutique](https://forum.wixstudio.com/u/cotswolddogboutique)\
**Post date:** [March 25, 2020, 5:31pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/16 "2020-03-25T17:31:34Z")

</div>

@juny929 thank you, I have just just checked my published version and all the shop pages and sliders are missing, is this something disabled on your end?

---

<div class="post-metadata">

**Author:** ![juny929](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/juny929/32/5955_2.png) [@juny929](https://forum.wixstudio.com/u/juny929)\
**Post date:** [March 25, 2020, 5:32pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/17 "2020-03-25T17:32:48Z")

</div>

@cotswolddogboutique That happens me now… All contents from database are missing in my published website.

---

<div class="post-metadata">

**Author:** ![ashfieldvaletingsupp](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ashfieldvaletingsupp/32/26491_2.png) [@ashfieldvaletingsupp](https://forum.wixstudio.com/u/ashfieldvaletingsupp)\
**Post date:** [April 5, 2022, 5:44pm UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/18 "2022-04-05T17:44:56Z")

</div>

Seems to be an issue again, sometime it’ll work, sometimes it won’t

---

<div class="post-metadata">

**Author:** ![Certified\_Code](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/certified_code/32/80179_2.png) [@Certified\_Code](https://forum.wixstudio.com/u/Certified_Code)\
**Post date:** [April 6, 2022, 1:18am UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/19 "2022-04-06T01:18:44Z")

</div>

Have you find the way to recreate the issue?

If possible, can you post the product page that does not work?

---

<div class="post-metadata">

**Author:** ![ashfieldvaletingsupp](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ashfieldvaletingsupp/32/26491_2.png) [@ashfieldvaletingsupp](https://forum.wixstudio.com/u/ashfieldvaletingsupp)\
**Post date:** [April 6, 2022, 10:47am UTC](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348/20 "2022-04-06T10:47:38Z")

</div>

@certified-code its happening every time. the product page is: [https://www.ashfieldvaletingsupplies.co.uk/product-page/blood-rain-500ml](https://www.ashfieldvaletingsupplies.co.uk/product-page/blood-rain-500ml)  
I can see it failing in the console.

[Next page](https://forum.wixstudio.com/t/getproduct-is-not-a-function/25348.md?page=2)
