Overview
UpCart has a Public API that contains plenty of variables and functions that can be used to build customizations. The API goes into each variable and function in more detail.
To view our Public API, click the button below!
Example of API Use
In this example, let's say we want to hide UpCart's Sticky Cart Button if there are 0 items in the cart.
Well, we can check the item count of the cart by using the window.upcartOnCartLoaded() function, which is passed the Shopify Cart Object as a parameter.
Taking a look at Shopify's documentation on the Cart object, we can see that it contains an item_count
variable, seen in yellow in the image below.
Knowing this now, we can use this to check if the cart contains 0 items!
So let's do this together in the video below: