Skip to main content

I’m working with the following logic:

event|lookup:'event.Items.0' == "Tray"
 

I want a specific content block to appear based on what was purchased (either a Tray Table or a Weighted Blanket). What is the correct syntax? I actually already tried the following:

event|lookup:'event.Items.0' == "Tray Table"
event|lookup:'event.Items.0' == "Weighted Blanket"
 

Lastly, how about if a customer purchases both items? I'm planning to create another section for that but what is the correct logic for that?
 

Thank you!

Hi @Keslie,

Thanks for your reply.

The second example is more correct but not quite. Ensure that the capitalization matches the item name exactly i.e. if it’s Weighted Blanket it should be Weighted Blanket and not WEIGHTED BLANKET. I used all caps in the example but it needs to match the capitalization exactly.

Also, there shouldn’t be any single quotes around the event.Items part. 

Also double check that the tag in the event data is indeed event.Items (not event.Collections or something else). The “final product” should look like the example below (just replacing name_of_item with the actual name of the product)

"name_of_item" in event.Items
 

I hope that helps resolve the issue.


Hi @Keslie,

Thanks for sharing this question with us.

You’ll want to use the format outlined in the thread below:

Although it uses event.Categories, the same theory will apply to event.Items.

In terms of separators, you can use “and” or “or” conditions to add multiples rules to the conditional hide/show statement. If you use “or” the user would have to meet one of the criteria i.e. purchased either item A or item B to show the block. If you use “and”, it will require that the user meets both criteria i.e. purchased item A and item B to show the block. Here’s an example using collections with or separators:

"PONYTALE" in event.Collections or "HOUSE" in event.Collections

I touch upon that (in a reverse use-case, hiding the block) in the thread below if you’d like to reference that as well:

I hope that’s helpful.

 


Hi @Dov,

Thanks so much for your response. I apologize as my coding knowledge is limited. I’ve tried implementing the code below and I’m not sure if I followed the instructions correctly as it is still not showing properly. Is there anything wrong with the syntax?

event|lookup:'event.Items' = "WEIGHTED BLANKET"

Thank you!


Hi again @Dov,

I responded in another discussion and another community manager mentioned that I should be using “PROPERTY” in event.variable format since my data set is a list/ array. I’ve tried the following and I can’t get it to work still.
 

“WEIGHTED BLANKET” in event|lookup:'event.Items'

“WEIGHTED BLANKET” in 'event.Items'

Can you advise if there’s a mistake in the syntax?

Thank you!


Reply