我正在使用 shopify ajax api 将产品添加到我的客户购物车,并有一个带有以下代码的 js 文件
Shopify.onError = function(error) {
alert('Error: ' + error.message);
},
Shopify.onCartUpdate = function(cart) {
alert("There are now "+ cart.item_count + " items in the cart.");
},
Shopify.onItemAdded = function(line_item) {
alert(line_item.title + ' Was aloted to your shopping cart');
},
Shopify.onProduct = function(product) {
alert('Received everything we ever wanted to know about '+ product.title);
},
我的印象将取决于 ajax 结果返回上述消息之一
我正在使用以下声明拨打电话
<button class="button" onclick="Shopify.addItem(jQuery('#add_item').val(), jQuery('#add_item_qty').val());return false"><i class="foundicon-cart"></i> Add to cart</button>
虽然返回默认消息但它正在工作