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.
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.
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.