Out-of-Stock Items and Automated Flow Emails for Magento

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 that the same item is 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.

In Klaviyo, you can 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

For Magento stores, Klaviyo will "un-publish" an item when the following is true:

  • The "visiblity" of an item is 1, meaning the visibility status is  NOT VISIBLE
  • The "status" of an item is 2, meaning the status is DISABLED
  • The product is out-of-stock, where IS_IN_STOCK -> 0

You must have "manage stock" = yes in your Magento Admin panel. 

The Abandoned Cart Flow

Klaviyo's default abandoned cart 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 be 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 on Rows. Next, toggle Column 1 from Image to Text
 
2017-05-11_13-24-50.gif

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

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

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

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 email will not be sent
  • 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)
skipped_out_of_stock.png

Note

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, just as you would for an abandoned cart email.

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

{% catalog event.ProductID unpublished="cancel" %} 
<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 snippet in your text block.

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:
  1. Adjust your email templates as explained above
  2. View an item on your site and/or start a checkout with a single item in your cart
  3. Wait until you see your tracked event appear in your account's Activity Feed
  4. Mark this single item out-of-stock in your store's backend
  5. Navigate to the flow that is triggered by the action you took (Viewed Product or Started Checkout) and has your newly adjusted email templates
  6. Click to preview one of these emails, and make sure the "choose a recent event to preview with" window features your own recent event
  7. 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.png
Was this article helpful?
1 out of 1 found this helpful