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") });
});
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.
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.