Skip to main content

Hey everyone,

Problem with Back-in-Stock emails

So I ran into this annoying problem with Back-in-Stock emails - customers subscribe to out-of-stock products, get the confirmation email, but there's no way to show them alternatives.

The thing is, you can't modify Klaviyo events after they're sent. PrestaShop integration fires the event and that's it - it's locked. Can't touch it. And I really didn't want to start messing with official integration code.

 

The workaround I came up with:

Instead of trying to modify the event (impossible), I'm using Klaviyo profiles as temporary storage through Flow webhooks. Basically:

  1. Flow webhook fires before the email → my service grabs similar products from PrestaShop → stores them temporarily in the user's profile
  2. Email template reads from the profile → renders products directly from Klaviyo Catalog
  3. Another webhook after email → cleans up the temporary data

The profile ends up with something like this for a bit:

"bis_similar_products": [
  {
    "product_id": "4422",
    "similar_ids": ["15655", "11773", "9012", ...],
    "enriched_at": "2025-10-30T12:34:56Z"
  }
]

Realized this pattern could work for a bunch of other stuff too - abandoned cart with "frequently bought together", price drop alerts, dynamic discounts, whatever needs external data in emails without touching events.

 

What it does:

The service finds similar products using BM25 (same algorithm Elasticsearch uses) - looks at product name, price, and manufacturer. Only shows stuff that's actually in stock. Works with PrestaShop 1.7 right now, happy to build WooCommerce, Shopify etc. adapters if there's interest.

Pure Python with basic text matching. Runs fine on shared hosting. I wanted something that actually works in production without complicated infrastructure.

 

I put it on GitHub:

https://github.com/mbridge-pl-agency/klaviyo-similar-products

 

Full setup docs, email template examples, the whole thing. Use it however you want.

The email template part is pretty straightforward - just checks if that profile property exists and loops through the product IDs:

{% if person.bis_similar_products %}
  <h3>While you wait, check these alternatives:</h3>

  {% catalog product_id integration='prestashop' %}
    <img src="{{ catalog_item.featured_image.full.src }}" />
    <h4>{{ catalog_item.title }}</h4>
    <p>{{ catalog_item.price }}</p>
    <a href="{{ catalog_item.url }}">Shop Now</a>
  {% endcatalog %}
{% endif %}

Template examples in the repo handle discount prices, responsive design, all that stuff.

---------------------

Anyway, if this sounds useful for your setup, check it out. Happy to answer questions if anyone wants to implement something similar or adapt it for other platforms. Also accepting PRs if anyone wants to build the WooCommerce/Shopify adapters!

Be the first to reply!