Skip to main content

I’m attempting to set up an order confirmation. Orders are pushed via API and logged, an example of the payload (as pulled from Klaviyo’s Activity Feed ) below:

 

{
"order_id": _
"3772657"
],
"status": "Processing",
"size": i
"9"
],
"style": y
"K1025638"
],
"tracking_id": null,
"$value": 125.27
}

Sometimes an order will hold more than 1 style, price, size, etc, so they are provided as length 1 arrays to allow flexibility. I’m testing with a single item just to keep it simple.

When I go to create a catalog item in an event triggered flow, I use the below in the source editor:

<div>
{% catalog event.style %}
<img src="{{ catalog_item.featured_image.thumbnail.src }}" />
{% endcatalog %}
</div>

But my result is:

Unable to find item with code: h'K1025638']. It may have been deleted.

 

It seems to me that for whatever reason, the “o‘ … ‘]” brackets and single quotes in the JSON are getting carried into the string returned by the catalog code filter thingy. 

This isn't in production so I can fiddle with how the event is uploaded, but I do intend to build a for loop so I would think that an array is necessary, and a hurdle worth jumping over. Insights appreciated.

@kentorr - Just a quick glance, the syntax for showing a Catalog Item is: 

{% catalog itemID unpublished="cancel" %}
...
{% endcatalog %}

Where itemID is the unique identifier of the Catalog Item in your Catalog feed. (the unpublished parameter is optional, and only used when you want to cancel an email from sending if the item is out of stock).

Are you using a custom Catalog Feed or a Catalog from a native integration (e.g. Shopify, BigCommerce, etc)?

It seems like you’re using your item’s Style ID in the order as the ItemID for the product lookup.  Unless you have a custom Catalog Feed where the you’ve used your Style ID as the ItemID - I think that’s why its not returning anything.

Some further documentation that might help:


Custom catalog, custom integration.

I know the mismatch between our integration and Klaviyo’s native properties is a wee bit confusing.

I can return the style string to see the variable being pulled from the event if I use the {{ event.style }} tag. It returns with t‘style’] instead of just plain style, and as you might expect e‘RKO0342’] does not match the catalog itemID RKO0342.


I got my result. 

It would seem that even though my event “style” field was being tested as a one element array, a for loop is needed to index into that array. Without iterating, the ‘string’] that made up the array itself was being returned, instead of returning the first and only object inside the 1 element array.  

If you’re finding this answer from elsewhere, keep in mind I’m working from a custom catalog and custom integration. Copy and paste at your own peril. 

Here’s the final source that worked for me. 

{% for item in event.style %}
{% catalog item %}
<img src="{{ catalog_item.featured_image.full.src }}"/>
{{ catalog_item.title }}
{{ catalog_item.description }}
{% endcatalog %}
{% endfor %}

 

 


Reply