working with simple product or product with variants , always use product.selected_product object , in the case of product with multiple variants product.selected_product will always reference the the variant of the lowest price
product add to cart (simple product) :
<form id="product-form">
<!-- you must refer the product id input by 'product-id' -->
<input id="product-id" type="hidden" value="{{ product.selected_product.id }}">
<!-- you must refer the product quantity input by 'product-quantity' -->
<input id="product-quantity" type="hidden" value="1">
<button class="btn btn-primary" type="button" onclick="productAddToCart()">
{{ locals.add_to_cart }}
<img class="add-to-cart-progress d-none" src="{{ asset_url ~ 'spinner.gif' }}" width="30" height="30"/>
</button>
</form>
<script>
//you must include zid api library first
//check zid-api librarry
function productAddToCart() {
$('.add-to-cart-progress').removeClass('d-none');
zid.store.cart.addProduct({ formId:'product-form' }).then(function (response) {
if(response.status === 'success'){
alert('product added to cart successfully');
setCartBadge(response.data.cart.products_count)
}
$('.add-to-cart-progress').addClass('d-none');
})
}
</script>