onAddToCart( )


Adds an event handler that runs when the Add To Cart button on the Product Page is clicked.

This function is currently only available for Wix Studio sites.

The onAddToCart() function adds an event handler that runs when a site visitor clicks the Add To Cart button on the Product Page.

The event handler has 2 functions:

  • The cancel() function stops a site visitor from proceeding with the Wix Checkout process.
  • The resume() function allows a site visitor to proceed with the Wix Checkout process.
Method Declaration
Copy
Method Parameters
addToCartEventHandlerfunctionRequired

addToCartEventHandler(resume: Function, cancel: Function): void The function to run when the Add To Cart button on the Product Page is clicked.

Did this help?