How to reduce calls to cart.js at Shopify?

Why Zowie needs access to cart.js?

Zowie users API call to Shopify's /cart.js endpoint in order to get the latest state of cart to provide required data for our Zowie Proactive Chats and Zowie Inbox products. As Shopify doesn't offer any JS callback to track changes in the cart, Zowie has to call /cart.js endpoint on regular basis and now the interval is set to 5 seconds.

Can we avoid calling the cart.js?

Yes, we strongly recommend that you switch from our interval-based API calling to the mechanism, that allows you notify Zowie whenever a cart has been updated. We recommend to notify Zowie once these events occure:

  • Required:
    • customer added an item to a cart
    • customer removed an item from a cart
  • Optional:
    • customer cleared out a cart
    • customer placed an order

Whenever one of the above happens, you can notify Zowie to update cart by calling our JS API:

Zowie.updateCart()

Once it's added to your setup, you can disable our interval-based calls with the following configuration parameter:

Zowie.init({
 ...
 ecommerceCartWatchEnabled: false
 ...
});