You will learn

Learn how to skip flow emails that feature unavailable products when you use Klaviyo's Magento 2 integration. These instructions cover abandoned cart emails triggered by Started Checkout and browse abandonment emails triggered by Viewed Product.

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 their 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 your abandoned cart or browse abandonment flow so emails are skipped when a featured product is unpublished or missing from your Klaviyo catalog. To use this feature, update the dynamic image in each email you want to check.

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

  • The "status" of an item is 2, meaning the status is DISABLED
  • The product is out of stock and inventory is being tracked.

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

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 their abandoned cart.

To skip an abandoned cart email when a featured product is unavailable, update the image in its dynamic table. The snippet below uses event.Items as the Row collection and item as the Row alias, matching the default Magento 2 Started Checkout template. If your event data or row alias differs, use the product ID from that event and the alias configured in your table.

  1. Click on your dynamic table in the email template editor.
  2. In the Content tab, select the cell containing the product image.
  3. Under Cell content, keep Image selected.
Example of a dynamic table block configuration in the email template editor.
Example of a dynamic table block configuration in the email template editor.
  1. Click Replace for the image, then select Dynamic image.
  2. In Dynamic variable or dynamic URL, replace the existing value with this snippet:

[codeSnippet]

  1. Click Save. Keep the existing Link address so the image still links to the customer’s cart, and keep the image width you want. Click outside the table and wait for the editor to finish saving. Repeat these changes for each abandoned cart email you want to check.

What this will do:

  • When Klaviyo prepares the email to send, it looks up each product referenced by the catalog tags in that email.
  • If any one item is "unpublished" in your catalog at the time of lookup, the email will not be sent
  • Select the email in your flow and click View details. Open Recipient activity > Skipped, then select Skipped: Catalog Item Unavailable from the Type dropdown.
  • This is where you can view all emails that were canceled -- 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)
Recipient Activity page showing skipped reason 'Catalog item unavailable'.
Recipient Activity page showing skipped reason 'Catalog item unavailable'.

With unpublished="cancel", the entire email is skipped if any referenced product is unpublished. If someone abandons 5 items in a cart and 1 of those products becomes unpublished, this method still cancels the full email. It does not remove only that item.

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 on your website.

If you want browse abandonment emails to automatically get canceled if they are going to feature an item that has since gone out-of-stock, you have to adjust the image section of the existing table in a given template.

  1. Click the static table in your browse abandonment email template.
  2. In the Content tab, select the cell containing the product image.
  3. Under Cell content, keep Image selected.
Example of a dynamic table block configuration in the email template editor.
Example of a dynamic table block configuration in the email template editor.
  1. Click Replace for the image, then select Dynamic image.
  2. In Dynamic variable or dynamic URL, replace the existing value with this snippet:

[codeSnippet]

  1. Click Save. Keep the existing Link address so the image still links to the product, and keep the image width you want. Click outside the table and wait for the editor to finish saving. Repeat these changes for each browse abandonment email you want to check.

What this will do:

  • When Klaviyo prepares the email to send, it looks up the product referenced by the catalog tag.
  • If this item is "unpublished" in your catalog at the time of lookup, the email will get skipped
  • Select the email in your flow and click View details. Open Recipient activity > Skipped, then select Skipped: Catalog Item Unavailable from the Type dropdown.
  • This is where you can view all emails that were canceled -- 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)

Test the out-of-stock feature

Test with a product that is currently in stock and has already synced to your Klaviyo catalog.

  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. Navigate to the flow that is triggered by the action you took (Viewed Product or Started Checkout) and has your newly adjusted email templates
  5. Open the email in the template editor and click Preview. Select your recent event and confirm that the product image loads while the product is in stock.
  6. Mark this product out of stock in Magento 2, then wait for the change to sync to your Klaviyo catalog. For a configurable product, test the parent product’s availability, not just 1 size or color.
  7. Reopen Preview for the same email and select the same event.
  8. The product image should no longer load. With the lookup in the dynamic image URL, the unavailable-item message is not displayed as text in the email body. A missing image alone is not proof of a stock-related skip, so first confirm that the in-stock preview worked.
Example of an email preview showing a message that a specific item is unavailable.
Example of an email preview showing a message that a specific item is unavailable.

When the flow attempts to send an email with an unpublished product, confirm that it appears under Skipped: Catalog Item Unavailable using the reporting steps above. Restore the product’s stock status after testing.

Additional resources

Learn more about the Magento integration:

Was this article helpful?
Use this form only for article feedback. Learn how to contact support.

Explore more from Klaviyo

Community
Connect with peers, partners, and Klaviyo experts to find inspiration, share insights, and get answers to all of your questions.
Partners
Hire a Klaviyo-certified expert to help you with a specific task, or for ongoing marketing management.
Support

Access support through your account.

Email support (free trial and paid accounts) Available 24/7

Chat/virtual assistance
Availability varies by location and plan type