onChange( )


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.

注釈

  • Use 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.
  • When editing a site as a contributor, onChange() will only work when viewing the live site.
メソッド宣言
コピー
メソッド・パラメータ
handlerfunctionRequired

handler(cart: CartObj): void The name of the function to run when a cart changes.

役に立ちましたか?
はい
いいえ