getproduct is not working again
Hi Oded,
i used the code below on a dynamic product page and keeps giving the error (‘getProduct’ does not exist on ‘#productPage1’), is there an alternative piece of code i can use for dynamic page??
import { session } from ‘wix-storage’ ;
import wixLocation from ‘wix-location’ ;
$w.onReady( function () {
$w( “#getquote” ).onClick((event) => {
$w( ‘#productPage1’ ).getProduct()
.then((product) => {
let theProduct = product._id;
session.setItem( “product” , theProduct);
})
.then(() => {
wixLocation.to( “/quote” );
})
. catch ((error) => {
console.log(error);
});
});
});
The above code only works from within the product page, it does not work from a dynamic page.