@plomteuxquentin Thank you so much for the response this helped a ton and give me a good starting point. I appreciate it as for some reason I just could not get my head around it.
I made good progress and this is what I have so far and the code does work.
I reduced it only to 2 donuts for now just for testing.
import { cart } from 'wix-stores';
$w.onReady(function () {
$w("#donut1").onChange(CartButtonEnableDisable);
$w("#donut2").onChange(CartButtonEnableDisable);
});
function CartButtonEnableDisable() {
let selOptA=Number($w("#donut1").value);
let selOptB=Number($w("#donut2").value);
let totalLength = (selOptA + selOptB)
if(totalLength >= 6){
$w('#buyNow').enable();
} else $w('#buyNow').disable();
console.log(totalLength)
}
export function buyNow_click(event) {
let selOptA=Number($w("#donut1").value);
let donuts="2112c343-cecb-1666-eff9-2c422bdc5075"
$w("#shoppingCartIcon1").addToCart(donuts,selOptA)
.then( () => {
console.log("Product added");
} )
.catch( (error) => {
console.log(error);
} );
}
My question is do you know how to add more then one donut with quantity to cart at the same time?
I went through the API and forums and cannot find a clear way to do it. I know there is a Velo example that walks through it but it seems to be way more then what I need.
Thanks!