I’m trying to create an add to cart button using the addToCart API with multple options and a custom text field. I’m using the below code, but just can’t get it to work. I’ve been trying to fix this for months - can anyone see anything wrong with this:
export function button1_click(event) {
//Add your code for this event here:
$w(“#shoppingCartIcon1”).addToCart(“f40e3741-5c56-a54e-f4a8-6ee5ad994200”, 1, {
“Anti-Aging”:{choices:
[{value:“None”,
description:“None”,
inStock: true ,
visible: true ,
mainMedia:“wix:image://v1/614034_103e8f4ab0ae4536a38b319d3eb437ed~mv2.png/missing-media.png#originWidth=500&originHeight=500”,
mediaItems:}]},
“Rejuvenating & Soothing”:{choices:
[{value:“None”,
description:“None”,
inStock: true ,
visible: true ,
mainMedia:“wix:image://v1/614034_103e8f4ab0ae4536a38b319d3eb437ed~mv2.png/missing-media.png#originWidth=500&originHeight=500”,
mediaItems:}]},
“Lifting & Firming”:{choices:
[{value:“None”,
description:“None”,
inStock: true ,
visible: true ,
mainMedia:“wix:image://v1/614034_103e8f4ab0ae4536a38b319d3eb437ed~mv2.png/missing-media.png#originWidth=500&originHeight=500”,
mediaItems:}]},
“Blemish Reduction”:{choices:
[{value:“None”,
description:“None”,
inStock: true ,
visible: true ,
mainMedia:“wix:image://v1/614034_103e8f4ab0ae4536a38b319d3eb437ed~mv2.png/missing-media.png#originWidth=500&originHeight=500”,
mediaItems:}]},
customTextFields: [{
“title”:“Who is the custom cream for?”,
“value”:“John”}]}
)
}