onCartChange( )


Triggered when a cart changes.

Triggered when:

  • A cart is modified by native UI elements such as the 'Add to Cart' button, increase (+) and decrease (-) item quantity buttons, remove line item button (x), etc.
  • The refreshCart() method is called.

Note: Actions performed by any method other than refreshCart() don't trigger onCartChange().

Method Declaration
Copy
Method Parameters
handlerfunctionRequired

handler(): void The method to run when the cart changes.

Did this help?