I tried adding a product I created in the GUI to the cart via code. I used the product id from the database at: site structure/databases/stores/products/inventory item
Where do I get the correct productId from?
Thanks
Below is the code I used to add the product to the cart:
export function add_to_cart(productId){
let products = [{
"productId": productId,
"quantity": 1
},
]
$w("#shoppingCartIcon1").addToCart(productId).then( () => {
console.log("Product added");
} )
.catch( (error) => {
console.log(error);
} );
}
I also tried the newer version with
cart.addProducts(products)
described in addProducts - Velo API Reference - Wix.com
Both returned with
FetchError: Product with id xxx was not found