I’m having trouble with
getProduct() method on product page element promise not resolving
doesn’t seem to worth with await
doesn’t allow .then chain even tho the docs clearly state it should
Working in
wix studio
import { canAddSampleToCart } from 'backend/sampleChecks.web.js';
$w.onReady(async function () {
console.log($w('#productPage1'));
setTimeout(() => {
const product = $w('#productPage1').getProduct();
console.log('product:', product);
}, 5000);
$w('#productPage1').onAddToCart(async(resume, cancel) => {
const result = await canAddSampleToCart();
console.log('result:', result);
});
$w('#productPage1').onQuantityChanged((quantity) => {
});
});
i added the setTimeout for testing.
because even tho it returns a promise… it doesnt await
just returns <promise>no matter what…
won’t allow .then() chaining… even tho the docs clearly show it should…
i don’t think im missing anything here, right?
