Hello all,
I am creating a dynamic product page for our site, some important background is that our catalog can be broken into 3 pieces with reference to product options. For instance, some products have a warranty only, some have warranty and a bonus part, some just have a size option only.
Now I’ve been able to make the page populate the radio buttons properly for whichever button is on the page.
My issue is originating in creating the product and adding it to the cart, as stated above I get an error in the console due to the productId not being a GUID for whatever reason.
Now this code is really just me testing whether I can make it work before incorporating option prices and everything else I need.
let warrantySelection = $w('#radioGroup1').value;
console.log(warrantySelection)//this was just me seeing if I could know whether or not it was grabbing the selection
{
$w('#addToCart').onClick(async ()=> {
const productOptions = warrantySelection
const productData = $w('#dynamicDataset').getCurrentItem()
const productId = productData._id
const product = [
productId,
Number(1),
productOptions,
]
const result = await cart
.addProducts(product)
.catch(error => console.error(error))
console.log(result)
})}