.getProduct() returns undefined! Is it a bug?

My (Wix Stores/Product-Page) is returning ’ undefined ', why? Is it a temporarily bug? I’ve tried Incognito (Instead of clearing the cache) and the issue persisted.

$w.onReady(async function () {
    product = await $w('#productPage').getProduct().then(async() => {
        if (product !== undefined) {
            // Initialize Wishlist & Reviews
        } else {
            $w('#wishlistStrip').collapse().then(() => {
                $w('#productIdErrorStrip').expand();
                console.warn("Wishlist & Product Reviews failed to load: The retrieved product id cannot be undefined")
                })
        }
    }).catch((err) => { $w('#productIdErrorStrip').expand(); console.warn("Wishlist & Product Reviews failed to load: Product ID couldn't be retrieved") });
}); 

Screenshots:


What’s going on? Help is appreciated.

Ahmad

Not getting any issue with the getProduct function in the wishlist example, that is all working fine in preview and in live.
https://www.wix.com/corvid/example/wishlist
https://support.wix.com/en/article/corvid-tutorial-adding-a-wishlist-to-a-wix-stores-site

https://givemeawhisky.wixsite.com/wishlisttest

Hi @givemeawhisky , Thanks for your reply.

It has nothing to do with the wishlist or the reviews apps, I included the screenshots to proof that the product ID couldn’t be retrieved from the $w.ProductPage. Hence their code is not included in the code above.

That warning in the console and the error message on the page was built in case the product ID extraction has failed, I assure you that it’s returning an undefined value, that explains the error message on the page and on the console log.

The issue hasn’t been solved until now! Comment #up to move this post up…

Try this

$w.onReady( function () {
$w(‘#productPage’).getProduct()
.then( (product) => {
console.log(product);
})
. catch ( (error) => {
console.log(error);
});
});

If the above code works then it means there is an issue with the code you have written, if the above code does not work it means there is an issue with Wix.

Hi Shan, I did try to comment all the other lines, and wrote a similar code like yours, and still get undefined.