Skip to main content

While writing this up, I came up with a solution, but it sort of sidesteps the problem.

This documentation indicates that I’d reference the product image like:

{% catalog event.VariantId integration:'shopify' %} {{ catalog_item.variant.featured_image.full.src|default:"" }} {% endcatalog %}

I only have one catalog, so I tried removing the integration parameter

{% catalog event.VariantId %} {{ catalog_item.variant.featured_image.full.src|default:"" }} {% endcatalog %}

That performs a lookup, but returns “Unable to find item with code: xxxxxx. It may have been deleted.

I ended up solving this by just referencing the product instead of the variant:

{% catalog event.ProductId  %} {{ catalog_item.featured_image.full.src|default:"" }} {% endcatalog %}

I’m guessing there’s something different between a custom catalog setup using the API vs one of the standard integrations. I’m also wondering if there’s a way to specify in the {% catalog %} tag that I’m passing in a Variant Id instead of an Item Id.

I guess I’d still like to figure out how to get this to work with the VariantId in case I wanted to test a version that directly adds the appropriate variant to the shopping cart… thoughts?

 

Hi @stem!

I’m going to run this by Engineering and I’ll update the thread ASAP!

 

Best,

Brian


Hi @stem!
 

It’s true that there are differences between the API catalogs and catalogs from native integrations. Can you try this syntax instead, and let me know if it solve the issue?

{% catalog 'event.VariantId' integration='api' %} {{ catalog_item }} {% endcatalog %}

 

Best,

Brian


I tried a number of different values for integration, including ‘api’ so I don’t think that’s the answer in and of itself. Is the distinction of placing event.VariantId in single quotes relevant?

I can’t test this right away, but a definitive “this is the syntax that will work” will be very helpful when we revisit these templates. 


Hi @stem!
 

The above syntax I supplied is the correct syntax to accomplish your use case (as I understand it after reproducing the issue). I will reach out internally to determine if any updates are required in the documentation to reflect this!

 

Best,

Brian


I still receive an error with this syntax:

{% catalog 'event.VariantId' integration='api' %} {{ catalog_item.variant.featured_image.full.src|default:"" }} {% endcatalog %}

Error:
Unable to find item with code: event.VariantId. It may have been deleted.

For reference:

  • ProductID: 298636

  • VariantId: 298636-0

This is what I’m using that works:

{% catalog event.ProductID %} {{ catalog_item.featured_image.full.src|default:"" }} {% endcatalog %}

 


Hi @stem!

My apologies for the delay here! If the syntax I provided is not accomplishing your use case, then it would probably be best to handle this issue with Support, as they will be able to troubleshoot with higher account-level access.

 

Best,
Brian


Thanks. I think I’m having other issues with Back In Stock flow. If I uncover a useful insight with support, I’ll come back and share with the community :)


hey @stem $ @Brian Turcotte ! I see this thread is solved, but could you share a bit more of what you found that was wrong? I am having the same issues, I opened a Klaviyo Support Ticket, but I didn’t get any help. Maybe you can share what was wrong in your case? 🙏

 
If I simply add to a text block into source code the following: {% catalog event.VariantId %} {{ catalog_item.featured_image.full.src }} {% endcatalog %} , in the preview it generates the product’s image link, but if I add it with some other code (as in the example), it doesn’t generate anything in the preview.

<h3 style="text-align: center;"><span style="font-weight: 400;"><img src="{% catalog event.VariantId %} {{ catalog_item.featured_image.full.src }} {% endcatalog %}" alt="" width="100" height="80" align="center" /></span></h3>
<p>&nbsp;</p>

or

<h3 style="text-align: center;"><span style="font-weight: 400;"><img src="{% catalog 'event.VariantId' integration='api' %} {{ catalog_item.featured_image.full.src }} {% endcatalog %}" alt="" width="100" height="80" align="center" /></span></h3>
<p>&nbsp;</p>

 

I can see the product I tested in Products → Back in stock reports moved to the next step. It’s a custom integration, 1 published catalog and metric coming from API. Thanks for any insight and great thread!


The core issue I was having was with the catalog:


Documentation references Variant ID and not SKU, but there was an issue with our SKUs. For products with NO actual variations, a variation still needs to be created … we were actually sending 0 for SKU in the case of these. When I started sending the same value for Variant ID and SKU, the problems we were having resolved.

 

The frustrating bit was that SKU wasn’t mentioned in either the documentation or the error messaging, so solving this was just a random eureka (or “doh!”) moment on my part.

It’s possible that this was also causing the issue with the template which was the seed of this thread, but that’s in a “It’s not breaking, so I’m not touching it” state.


Hey @stem ! Thanks a lot for your feedback, it really helped. Indeed it’s a catalog issue, not a tag refence code issue. In my case, it seems Variant ID and item ID have the same values (the same applies for SKU too), while they shouldn’t and it worked with using Product ID. Have a great week ahead and thanks once again for you input!


Reply