Displaying an image from a company's website when a certain product is ordered

  • 17 August 2021
  • 1 reply

Badge +6


I’m in the middle of a post-purchase flow. One of the email messages in the flow is supposed to contain an image that links to an instructional video (a YouTube video that’s embedded on the company’s website). The image in the email is based on which product(s) a customer purchases. The company’s shop uses Shopify, but the images I want to display aren’t hosted there. 

Is it possible to use an if/else statement to display the image, its alt tag and link? What I’m thinking is that a certain image would be displayed based on the product ID (if productID = Product X’s ID, then display Product X’s image and have it link to Product X’s instructional video). If the customer ordered more than one product, I’d like to have images show for all the products that they purchased (note: there are only four products in total, so four would be the maximum number of products shown at once).

Thanks in advance!


Best answer by alex.hong 18 August 2021, 21:56

View original

1 reply

Userlevel 7
Badge +58

Hi @ajohns ,


Thanks for your question and great to hear you’re working on a post-purchase flow! 

There is actually something that works as an If/Else condition for templates and designing your emails! Inside Klaviyo, this is referred to as a dynamic variable. Dynamic variables can be utilized in templates as you can show or hide things based on variables such as if someone has bought a product. 

The first thing you'll want to do is make sure to set up Product Feeds so that you can pull producst from certain categories/collections: How to Use Product Feeds and Recommendations. Under your Data Feeds tab, you can set up Product Feeds to include only items from specific categories, which you can then use to populate products in your Product Block.
Once you've made your feeds, you can include them in your email content and use Show/Hide conditions to only display them when particular conditions are met: How to Show or Hide Template Blocks Based on Dynamic Variables. Since you're wanting to display these blocks based on a person's purchases, you'd likely want to include this in a Flow that is triggered by an event (Metric-Triggered Flow).


Hope this helped and feel free to report back with updates!