Show/Hide Blocks custom content based on purchase - Shopify

  • 14 February 2022
  • 2 replies

Badge +2

I am trying to set up content to display using show/hide box using information from Shopify’s field such as Name, or SKU.

When I send a newsletter through a campaign, I would like certain content to be shown to certain recipients who have purchased a certain product. 

I cannot seem to identify the Syntax for this, or find another solutions to do so.


Best answer by stephen.trumble 15 February 2022, 00:39

View original

2 replies

Userlevel 7
Badge +60

Hey @geosal 

Thank you so much for coming to the Klaviyo Community for help with your show/hide content

To identify the event variables you can use in your show/hide condition, navigate to the message editor within your flow or campaign, then click Preview

In the preview modal, you’ll see sample event data from your most recent event. Scroll through the data to find the variable you want to use, then click that variable. Then, copy the resulting variable tag. 

Note that you don’t need the curly brackets around the variable; you only need the variable text. In the screenshot below, you’ll see the variable tag {{ event|lookup:'Item Count' }}. You’ll only need the text event|lookup:'Item Count' for your show/hide condition. Similarly, if your variable tag was {{ event.extra.line_item.0.title }}, you can extract just the text — event.extra.line_item.0.title — from the tag. 


Hope this helps! Thank you so much for being part of the Klaviyo Community!

Badge +2

Hi guys, 


So, I'm trying to do this too using sku {{ event.extra.line_items.1.sku }} which I understand needs to be inputed into the logic as event.extra.line_items.1.sku, however i’m not sure how to write the logic. It seems to have changed recently, so I’ve tried various ways but can’t get it to work. Could someone please advise? 

(Additional info: I’m trying to display a CTA which will link to a product guide per sku. I’m using Checkout Started data to get access to all products in basket.)

'COLHSN3' in event|lookup:'sku'

sku: COLHSN3

event|lookup:'sku’: COLHSN3

event|lookup:'sku’ = COLHSN3

sku = COLHSN3

sku = 'COLHSN3'

sku == « COLHSN3 »

event|lookup:’sku’ = COLHSN3

event|lookup:’sku’ : COLHSN3

person|lookup:’sku’ = COLHSN3

person|lookup:’sku’ = ‘COLHSN3’

person|lookup:’sku’: 'COLHSN3'


Thanks so much !