I have the following code, but it is not adding any products to my cart.
import { cart } from ‘wix-stores’ ;
$w ( “#button20kW” ). onClick (() => {
cart . addProducts ([{
“productId” : “364215376135191” ,
“quantity” : 1
}])
. then (( updatedCart ) => {
// Products added to cart
const cartId = updatedCart . _id ;
const cartLineItems = updatedCart . lineItems ;
})
. catch (( error ) => {
console . log ( error );
});
});
$w ( ‘#30kw’ ). onClick (() => {
cart . addProducts ([{
“productId” : “364215376135191” ,
“quantity” : 1
}])
. then (( updatedCart ) => {
// Products added to cart
const cartId = updatedCart . _id ;
const cartLineItems = updatedCart . lineItems ;
})
. catch (( error ) => {
console . log ( error );
});
});
$w ( “#40kW” ). onClick (() => {
cart . addProducts ([{
“productId” : “364215376135191” ,
“quantity” : 1
}])
. then (( updatedCart ) => {
// Products added to cart
const cartId = updatedCart . _id ;
const cartLineItems = updatedCart . lineItems ;
})
. catch (( error ) => {
console . log ( error );
});
});