Our Web SDK lets you control the Cart Widget from your JavaScript code. This lets you listen to various events, as well as open, close the or do fancy stuff with the it. This guide helps you use Web SDK from your code.

Available Functions
Web SDK lets you do actions on the Corner cart. You have the following actions available (as JavaScript functions):

Event Listener Funtion
These following functions listens for a particular action in our widgets and when that happens the call back function you define will be executed

corner.on(eventName,callback)

EventNames

onCartEdit : When any type of edit happens on the cart
onCowiOpen : When cart widget is opened
onCowiClose : When cart widget is closed
onSatcAppear : When Sticky add to cart bar appears
onSatcDisappear : When Sticky add to cart bar disappears
onCartCtaClick : When CTA button on the cart is clicked
onSatcCtaClick : When CTA button on the Sticky add to cart is clicked

Example
The following function will print a message to the browser console every time some edit happens to the cart
corner.on("onCartEdit",()=>{console.log("Cart Edited")})


Information Fetch Function
These following function fetch certain informations from our end.

corner.get(infoName)

infoNames

cartInfo : Get cart object which includes information regarding your current cart
currentProduct : Get product object of the current product that your are in
pageType : Get the type of the page that you in

Example
The following function will asign the current page type to a variable named a
let a = corner.get("pageType")


Action Function
These functions lets you do something on the cart widget. Like opening and closing the widget

corner.do(actionName)

actionNames

openCart : Opens Cart
closeCart : Close Cart

Example
The following function will open the cart
let a = corner.do("openCart")
Was this article helpful?
Cancel
Thank you!