Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Add your custom code

Now the feature is on, each time the add to cart button is clicked a preezie custom event przAddToCartEvent will fire. You then need to place this script on your pages to fire with your own custom add to cart events that your platform uses.

The event param requires the product variant as productId and the quantity of 1 to be passed to it.

Code Block
languagejs
setTimeout(() => {

  const przWidget = document.getElementsByClassName('preezie-widget-app')[0]

  if(przWidget) {

    przWidget.addEventListener('przAddToCartEvent', (event) => {

        // event: { detail: { productId: productId || '', quantity: 1 } }

        // add your custom "add to cart" events here

    })

  }          

}, 2000);

...

You’re now ready to turn on and style your buttons, see the styling guide below.

...

Anchor
stylebuttons
stylebuttons
Turn on and style your buttons

...