[英]Shopify add to cart ajax update cart on button click - Update the cart note and the entire cart drawer
I am working on a shopify site where I have created a hover over option for quick shop.我在 shopify 网站上工作,我在该网站上创建了快速购物的悬停选项。 When the item is added to the cart I need the cart number to update and the cart drawer to update.
将商品添加到购物车后,我需要更新购物车编号和更新购物车抽屉。 However, this is not working!
然而,这是行不通的! Can someone help?
有人可以帮忙吗?
You could use something like:你可以使用类似的东西:
jQuery.getJSON('/cart.js', function(cart) {
$('#CartCount').text(cart.item_count)
});
Where #CartCount is your counter. #CartCount 是您的计数器。 For the dropdown cart itself, I believe you'd have to rebuild the cart yourself via the cart.js response.
对于下拉购物车本身,我相信您必须通过 cart.js 响应自己重建购物车。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.