Skip to main content

Imagine a world where you can guide your customers seamlessly back to their checkout with a single, personalized email. By leveraging webhooks in Klaviyo, you can achieve this—saving cart items and checkout URLs directly as properties on customer profiles. This innovative approach not only streamlines your email marketing but also enhances the customer experience. Let’s dive into how it works and why it’s a game-changer for your e-commerce strategy.

Why use webhooks to save cart items and checkout URLs?

Traditionally, abandoned checkout emails rely on the customer triggering an event, such as leaving their cart without completing a purchase. While effective, this approach has limitations—most notably, the delay in communication. With webhooks, you can save cart and checkout data in real time, enabling you to:

  • Send timely follow-ups: No need to wait for the abandoned checkout flow to trigger. Engage customers proactively.

  • Personalize at scale: Use Klaviyo’s person.lookup tag in campaigns and emails to dynamically pull cart contents and the exact checkout URL.

  • Enhance customer experience: Make it easy for customers to pick up where they left off with a single click.

How It Works

Step 1: Set up webhooks to capture cart data:

Using a webhook, you can capture key details about the customer’s cart and checkout session. These details, such as product names, quantities, and the checkout URL, are saved as properties on their Klaviyo profile.

Example payload: Save the checkout URL:

When a customer interacts with your store, your webhook can capture the checkout URL, like the following:

Header: https://a.klaviyo.com/api/profile-import

Authorization: Klaviyo-API-Key your-private-api-key

accept: application/vnd.api+json

Content-type: application/vnd.api+json

Revision: 2024-10-15

 

{
  "data": {
    "type": "profile",
    "attributes": {
      "properties": {
        "Checkout URL": "{{ event.extra.checkout_url|default:'' }}"
      },
      "email": "{{ person.email|default:'' }}"
    }
  }
}

 

Example payload: Save the customer cart: 

When a customer interacts with your store, your webhook can capture the checkout URL, like the following:

Header: https://a.klaviyo.com/api/profile-import

Authorization: Klaviyo-API-Key your-private-api-key

accept: application/vnd.api+json

Content-type: application/vnd.api+json

Revision: 2024-10-15

{
  "data": {
    "type": "profile",
    "attributes": {
      "properties": {
        "Produkt 1 name (Checkout)": "{{ event.Items.0|default:'' }}",
        "Produkt 1 Image (Checkout)": "{{ event.extra.line_items.0.product.images.0.src|default:'' }}",
        "Produkt 1 Brand (Checkout)": "{{ event.extra.line_items.0.product.vendor|default:'' }}"
      },
      "email": "{{ person.email|default:'' }}"
    }
  }
}

Hope that helps you get more revenue from your expiring carts :-)

@Christiannoerbjerg, thank you for sharing your insights with the community! 

~Chloe


Enhancing your e-commerce strategy by displaying customers' cart contents in emails without relying solely on the "Checkout Started" event is achievable through the use of webhooks in Klaviyo. Here's a streamlined approach:

1. Implement Webhooks to Capture Cart Data:

  • Set Up Webhooks: Configure webhooks to capture real-time cart details, including product names, quantities, and the checkout URL. This data is then stored as properties on the customer's profile in Klaviyo.

  • Example Payload for Checkout URL:

    { "data": { "type": "profile", "attributes": { "properties": { "Checkout URL": "{{ event.extra.checkout_url|default:'' }}" }, "email": "{{ person.email|default:'' }}" } } }

  • Example Payload for Cart Items:

    { "data": { "type": "profile", "attributes": { "properties": { "Product 1 Name": "{{ event.Items.0|default:'' }}", "Product 1 Image": "{{ event.extra.line_items.0.product.images.0.src|default:'' }}", "Product 1 Brand": "{{ event.extra.line_items.0.product.vendor|default:'' }}" }, "email": "{{ person.email|default:'' }}" } } }

2. Utilize Captured Data in Emails:

  • Dynamic Personalization: Incorporate the saved cart details into your email templates using Klaviyo’s person.lookup tag. This allows for dynamic insertion of cart contents and direct links back to the customer's checkout, enhancing personalization and user experience.

Benefits:

  • Timely Follow-Ups: Engage customers promptly without waiting for traditional abandoned cart triggers.

  • Enhanced Customer Experience: Provide a seamless path for customers to resume their shopping, potentially increasing conversion rates.

By implementing this webhook strategy, you can proactively display customers' baskets in emails, independent of the "Checkout Started" event, thereby improving engagement and sales opportunities.


Reply