J.D
June 9, 2021, 9:09pm
2
If you have the product data, you can add the product to the cart using code.
See:
How to handle checkbox value change:
https://www.wix.com/velo/reference/$w/checkboxgroup/onchange
How to add products to cart:
https://www.wix.com/velo/reference/wix-stores/cart/addproducts
Thanks for the reply. I changed my mind and decided to add products via a button. The adding button works, but I can’t add a button to remove the added product from the cart. could you help me? Sorry but I started very recently. Thank you
I used this to add products and perform related actions
import wixData from 'wix-data';
$w("#tastorabboccoliquidi").onClick( () => {
$w("#shoppingCartIcon1").addToCart("981c610f-23e6-d12c-6fd9-af6027950e67")
.then( () => {
console.log("Product added");
} )
.catch( (error) => {
console.log(error);
} );
$w('#tastorabboccoliquidi').hide();
$w('#checkbox').checked = true ;
$w('#box29').show();
$w('#dropdown6').show();
$w("#dropdown6").enable();
$w('#box30').show();
$w('#image71').show();
$w('#text154').show();
$w('#button25').show();
} );
J.D
June 11, 2021, 1:28pm
4