(Shopify) Out-of-Stock Items and Automated Flow Emails

Overview

If you run a business with high-demand inventory, and often sell out of popular items, it's possible that a customer will place an item in his/her cart one minute and come back hours later to find the same item out-of-stock.

While Abandoned Cart and Browse Abandonment flows can drive significant revenue to your business, fast selling inventory can make it challenging to send reminders that don't fall flat. Encouraging customers to return to a cart full of out-of-stock items can lead to a frustrating customer experience.

Klaviyo makes it easy to adjust any Abandoned Cart or Browse Abandonment flow to ensure emails featuring out-of-stock items get automatically cancelled. To take advantage of this feature, you will need to slightly update the way dynamic content is populated in your Abandoned Cart or Browse Abandonment emails.

Note: Klaviyo will only "un-publish" out-of-stock items for Shopify stores when the following is true:
  • Your inventory policy states that Shopify will track inventory for each product
  • You do not allow customers to purchase products when they go out-of-stock
692093

The Abandoned Cart Flow

Klaviyo's default Abandoned Cart email templates feature a dynamic table that is used to populate each email with the specific items the recipient left behind in his/her abandoned cart.

If you would like an Abandoned Cart email to automatically get cancelled if it is going to feature one or more items that have since gone out-of-stock, you will only need to adjust the image section of the existing dynamic table in a given template.

First, click on your dynamic table and click into Rows. Next, toggle Column 1 from Image to Text

691959

Here, click into the Source of this text block. In the Source area, you are going to copy/paste the following snippet.

{% catalog item.product_id unpublished="cancel" %}
<a href="{{ event.extra.responsive_checkout_url }}">
<img alt="" src="{{ catalog_item.featured_image.thumbnail.src }}" 
width="200px" /></a>
{% endcatalog %}

Make sure to then click Source again before clicking Save Changes to save this snippet in your text block.

692295

What this will do:

  • Before a given email in your flow is scheduled to send, Klaviyo will look up each item that will dynamically populate in the individual email
  • If any one item is "unpublished" in your catalog at time of lookup, the entire email will get skipped
  • For a given flow email, you can navigate to Analytics > Recipient Activity > Other and you will see a category labeled: Skipped: Catalog Item Unavailable
  • This is where you can view all emails that were cancelled - i.e. Skipped - because an item featured in the email was out-of-stock or otherwise unavailable (if the item is no longer in your catalog)
692091

At this time, it is not possible to remove a single out-of-stock item from an email and send the rest of the email as scheduled. If someone abandons 5 items in a cart, and only 1 of the 5 items has gone out-of-stock, this feature will still cancel the full email.

The Browse Abandonment Flow

Klaviyo's default Browse Abandonment email template features a static table block that is used to populate each email with the specific item a recipient browsed your website.

If you would like Browse Abandonment emails to automatically get cancelled if they are going to feature an item that has since gone out-of-stock, you will only need to adjust the image section of the existing table in a given template.

First, click on this table block and navigate to Rows. Next, toggle Column 1 from Image to Text.

692283

Here, delete the text "First Column" and click into the Source of this text block. In the Source area, you are going to copy/paste the following snippet:

{% catalog event.ProductID %} 
<a href="{{ catalog_item.url }}"><img src="{{ catalog_item.featured_image.full.src }}" width="200" /></a> 
{% endcatalog %}

After pasting this snippet, make sure to click Source again before clicking Save Changes to save this short snippet in your text block.

The red square in the following image represents what this snippet will look like in the Source of your text block. The green square in this image represents what this will look like in your email template after it is saved:

692290
What this will do:

  • Before a given email in your flow is scheduled to send, Klaviyo will look up the item that will dynamically populate in the individual email
  • If this item is "unpublished" in your catalog at the time of lookup, the email will get skipped
  • For a given flow email, you can navigate to Analytics > Recipient Activity > Other and you will see a category labeled: Skipped: Catalog Item Unavailable
  • This is where you can view all emails that were cancelled - i.e. Skipped - because an item featured in the email was out-of-stock or otherwise unavailable (if the item is no longer in your catalog)

How to Test Out-of-Stock Feature

The best way to test out this feature:
  • Adjust your email templates as explained above
  • View an item on your site and/or start a checkout with a single item in your cart
  • Wait until you see your tracked event appear in your account's Activity Feed
  • Temporarily mark this single item out-of-stock in your store's backend
  • Navigate to the flow that is triggered by the action you took (Viewed Product or Started Checkout) and has your newly adjusted email templates
  • Click to preview one of these emails, and make sure the "choose a recent event to preview with" window features your own recent event
  • When you click Preview, you should see a preview where the item's image doesn't populate and instead the following message appears: Item (XXXXXX) is not published and unavailable.
692342
Was this article helpful?
0 out of 0 found this helpful