Shopify.onItemAdded update #cart and cart.item.count

吃可爱长大的小学妹 提交于 2019-12-02 08:16:32

This might not be exactly what you need but it may help. I have made and implemented an ajax cart on a shopify site I develop for. I use jquery & JSON to do this type of stuff and here's what I do:

jQuery.getJSON('/cart.js', function (cart, textStatus) {
  //the cart info is in the callback. the item_count is available as part of the callback
  //below I set my cartcount div with the current cart item_count
  var carttext=cart.item_count;
  jQuery("#cartcount").text(carttext);
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!