Skip to main content
Solved

Using Jinja to load Dynamic Products from Product Feed


Forum|alt.badge.img+1

I have setup Product Feeds - for example “HomeOffice”, “LivingRoom”, “Lighting” - I have a tag on customer profile indicating the last category they browsed.  I want to use the jinja templating to display products based on the product feed.

 

I am aware I can create dynamic product grids, and set conditional logic to show the block when the category matches the profile category --- but that requires me to create 35 dynamic product grids, and copy them into every email (and that might cause other problems?).

 

What I am hoping I can do, but cannot figure out the correct syntax to do it, is to filter out the top 6/8 products from the feed, based on their profile lookup value - that way we have full control over styling, and can favorite one single re-usable block that will covert all of them.  

 

I am hoping for something like this:

{% if person.CatLabel|default:'' == 'LG' %}
{% feed 'Lighting' %}
{% elif person.CatLabel|default:'' == 'HO' %}
{% feed 'OfficeFurniture' %}
{% endif %}

{% catalog ‘Lighting’ as products %}
{% for product in products %}
{{ product.name }}
{% endfor %}

I’ve spoken with the support team, they say this should be possible, but they cannot help me with how to build this such that it actually renders.

 

 

I’ve tried to query products based on category, but for some reason its not an available field at the email template level (only filter triggers).   I do not have a good enough personalization engine to consider passing the actual product IDs for the blocks onto their profile, like in the documentation.

Best answer by kweiNRINC

I found the solution to my query through a blog post:

https://medium.com/klaviyo-developers/solution-recipe-4-extending-klaviyos-product-block-functionality-7cea60ae9cda

from @walid.bendris 

I’ve run into other limitations as I have a lot of repeat code due to the lookup based on if statements I need… but I can work through that.

View original
Did this topic or the replies in the thread help you find an answer to your question?

4 replies

Taylor Tarpley
Community Manager
Forum|alt.badge.img+60

Hi @kweiNRINC

 

Thanks for coming to the Community with this question and welcome! 

 

Since this does require custom coding, while these threads below might be helpful, the Klaviyo team can’t provide specific advice or direction, but I know we have a great dev group who like to collaborate together! Th

 

What do you say dev gang, can anyone help our friend figure out the correct syntax to accomplish this specific goal? 

 

Looking forward to it, 

Taylor 


Forum|alt.badge.img+1
  • Author
  • Problem Solver I
  • 3 replies
  • April 18, 2023

Thank you @Taylor Tarpley - I am hoping to find somebody with some level of experience here, I can’t find any formal way to filter the catalog based on product_feed, or to directly query a product_feed.


Brian Turcotte
Forum|alt.badge.img+37

Hi @kweiNRINC!

 

If you’re looking for custom development help, you can always reach out to one of our wonderful Official Partners here:

 

On this platform, you’re able to filter partners by budget, region, task, etc., in order to find the right help.

 

Thanks for using the Community!

- Brian


Forum|alt.badge.img+1
  • Author
  • Problem Solver I
  • 3 replies
  • Answer
  • April 19, 2023

I found the solution to my query through a blog post:

https://medium.com/klaviyo-developers/solution-recipe-4-extending-klaviyos-product-block-functionality-7cea60ae9cda

from @walid.bendris 

I’ve run into other limitations as I have a lot of repeat code due to the lookup based on if statements I need… but I can work through that.