Solved

Exclude out of stock products from browse abandonment flow - Woocommerce

  • 23 March 2023
  • 4 replies
  • 274 views

Badge +1
  • Problem Solver I
  • 3 replies

Hello I tested this snipped you provided in your forum but it doesn’t work.

When previewing the email it says “Unable to find item with code: . It may have been deleted.” for all products no matter if they are in stock or not. 

We are using Woocommerce + New editor

Is there an updated version of the code or different one for woocommerce or what could be the issue? 

Thank you for your time. 

{% catalog event.ProductID unpublished="cancel" %} 
<a href="{{ catalog_item.url }}"><img src="{{ catalog_item.featured_image.full.src }}" style="width: 200px;"
width="200px" /></a>
{% endcatalog %}
icon

Best answer by Libi 24 March 2023, 15:59

View original

4 replies

Userlevel 7
Badge +57

Hi @Libi, welcome to the community!

I’m not familiar with the Product catalog in WooCommerce, but if you are seeing the error “Unable to find item” - it’s means the value from your Event’s ProductID is not matching an item in your Product Catalog.

A few troubleshooting tips:

  • Check to see if ProductID is a value in your Event data. You can use this snippet {{ event.ProductID }} somewhere in your Template to see that value.
  • Go to your Product Catalog (Sidebar → Content → Products) and Search with that ProductID.  See if an item shows up - if nothing appears, then that means your Event’s ID isn’t being passed to Klaviyo, see if another variable works or make sure your Product Catalog is properly synced.
  • WooCommerce may not be properly syncing your products (to the product catalog) or not properly integrated.  Look to the troubleshooting tips here: Getting started with WooCommerce : Troubleshooting

Those are the initial steps I would check, but if those don’t work or you still have issues, I’ll leave this open to other Klaviyo folks who are WooCommerce experts to chime in further.

Badge +1

Hi. Thanks for your answer but it didn’t solve the problem. 

I need a code that will Exclude out of stock products from browse abandonment flow in Woocommerce.

The one I found it for Shopify. 

Userlevel 3
Badge +9

Hi. Thanks for your answer but it didn’t solve the problem. 

I need a code that will Exclude out of stock products from browse abandonment flow in Woocommerce.

The one I found it for Shopify. 

Try this:

{% if event.properties['Product ID'] %}
{% for product in collections.all.products %}
{% if product.id == event.properties['Product ID'] %}
{% if product.available %}
{# Insert code for displaying product link or details here #}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}

 

This code snippet first checks whether the product ID is available in the event properties, and then loops through all the products in your store. It then checks whether the current product ID matches the event product ID and whether the product is available or not. If the product is available, you can insert the code for displaying the product link or details.

You can add this code to your browse abandonment flow, and it should exclude any out of stock products from the email. Please make sure to replace "Product ID" with the actual property name for the product ID.

Badge +1

The issue was resolved with the Klaviyo tech support. The solution is:

For the Browse abandonment flow: 
{% catalog event.ItemId unpublished="cancel" %} <a href="{{ catalog_item.url }}"><img style="width: 200px;" src="{{ catalog_item.featured_image.full.src }}" width="200px" /></a> {% endcatalog %}

 

For the Price Drop Flow (with started checkout with the item trigger + Price drop trigger)

{% catalog event.product_id unpublished="cancel" %} <a href="{{ catalog_item.url }}"><img style="width: 200px;" src="{{ catalog_item.featured_image.full.src }}" width="200px" /></a> {% endcatalog %}

 

I followed this guideHow Do I Prevent Browse Abandonment Flow Emails from Showing an Out-of-Stock Product? | Community (klaviyo.com) But with the new code.

Hope this will help someone else as well. 
Thank you all for the help <3

Reply