Synchronize orders and customers with the Klaviyo marketing platform
npm install @pinelab/vendure-plugin-klaviyo
An extensible plugin for sending placed orders to the Klaviyo marketing platform.
The default setup will only send placed orders to Klaviyo
vendure-config.ts
:All placed orders will now be synced.
If you want to send more events to Klaviyo, you can implement your own handlers. For example, syncing account verification events to Klaviyo, so that you can send out welcome e-mails:
Create a custom handler klaviyo-account-verified-handler.ts
Register the handler in the plugin in your vendure-config.ts
If you'd like to send custom data in the Klaviyo native Order Placed event, you can also create a custom handler, but make sure to return a KlaviyoOrderPlacedEvent
instead of a KlaviyoGenericEvent
. The plugin will recognize your return type and handle it as an Order Placed event.
Don't forget to exclude the default order placed handler if you do!
This plugin includes a mutation klaviyoCheckoutStarted
, which can be called from your storefront. When called, and an active order is present, it sends a custom event Checkout Started
to Klaviyo, including basic order and profile data. This event can be used to set up abandoned cart email flows in Klaviyo.
The following mutation allows a customer to sign up to a Klaviyo Audience list via the API:
This mutation requires an active session, which means a customer should have interacted with the Vendure API already. This can be done for example by fetching an active order. This is to prevent unwanted bot sign ups. The customer will also receive a double opt-in email, asking them to confirm signing up for marketing emails.