Hi we have a wishlist, I was wondering if there is a way to track an “added to wishlist” event and therefore email people accordingly. We use woocommerce.
Thank you
Hi we have a wishlist, I was wondering if there is a way to track an “added to wishlist” event and therefore email people accordingly. We use woocommerce.
Thank you
Best answer by Christiannoerbjerg
Hi
Thank you for posting in the Community!
Let’s go over a possible solution, that might work :-)
Identify the wishlist solution you're using with WooCommerce. Common plugins include:
Most plugins trigger actions (such as adding an item to a wishlist) that you can hook into with WordPress/WooCommerce.
You can use Klaviyo’s Track API to send a custom "Added to Wishlist" event whenever a customer adds an item to their wishlist.
Add this PHP code to your WooCommerce site's child theme's functions.php
file or a custom plugin:
function klaviyo_track_wishlist_event($product_id) { // Get product details $product = wc_get_product($product_id); $product_name = $product->get_name(); $product_url = $product->get_permalink(); $product_image = wp_get_attachment_url($product->get_image_id()); // Get the user's email (requires they are logged in or capture it another way) $user = wp_get_current_user(); $user_email = $user->user_email; // Prepare Klaviyo API payload $payload = array( "token" => "YOUR_PUBLIC_API_KEY", // Replace with your Klaviyo public API key "event" => "Added to Wishlist", "customer_properties" => array( "$email" => $user_email ), "properties" => array( "Product Name" => $product_name, "Product URL" => $product_url, "Product Image" => $product_image ), "time" => time() ); // Send the event to Klaviyo $response = wp_remote_post("https://a.klaviyo.com/api/track", array( 'method' => 'POST', 'headers' => array( 'Content-Type' => 'application/json' ), 'body' => json_encode($payload) )); } // Hook into your wishlist plugin's "add to wishlist" action add_action('yith_wcwl_added_to_wishlist', 'klaviyo_track_wishlist_event', 10, 1);
What this does:
yith_wcwl_added_to_wishlist
) to trigger the event whenever a product is added to the wishlist.For other wishlist plugins:
yith_wcwl_added_to_wishlist
with the action provided by your specific plugin.Once the event is being tracked in Klaviyo, you can build a flow to email users who add items to their wishlist.
Hope that helps! :-)
Christian Nørbjerg Enger
Partner & CPO
Web: Segmento.dk
LinkedIn: @christianfromsegmento
Voldbjergvej 22b, 8240 Risskov
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.