An event handler that is triggered when items are added or removed from a cart.
について onChange()
function is a client-side event handler invoked every time the cart changes. It takes a callback function which receives the new カート
object as a parameter.
注釈
onChange()
in the global site code file (masterPage.js). This ensures the event is triggered when a change to the cart is made on any page. Learn more about global (site) code.onChange()
function can only be used once a page has loaded. Therefore, you must use it in code that is contained in or is called from the onReady() event handler or any element event handler.onChange()
will only work when viewing the live site.
handler(cart: CartObj): void The name of the function to run when a cart changes.