Solved

Show/Hide logic for (Shopify) Fulfilled Order

  • 13 September 2022
  • 2 replies
  • 216 views

Badge +8

Hi guys. Trying to build an email for a pet brand. Depending on what a customer bought we want to show them:

  • Cat related content
  • Dog related content
  • Cat & Dog related content 

So the email is broken up into 3 sections all with their own Show/Hide logic on the section. Now the Shopify store has a lot of item variables, so we figured we could use top level “Collections” in order to target cat/dog/both. I’ve made three branches within a flow - one for dry food, one for wet food and then treats. The wet & dry are working fine - however treats email keeps telling me there is invalid syntax?? Can someone tell me if the following logic I’ve used is correct?

Basically I’m telling it if Cat treats appears in collections and not dog treats or dental sticks, show the cat related content. Is it broken because I’ve used 3 pieces of logic? Or am I missing something?

I’ve done this for the other two blocks as well:

"Dog Treats" in event.Collections and "Dental Sticks for Dogs" in event.Collections and not “Cat Treats” in event.Collections.

"Dog Treats" in event.Collections and "Dental Sticks for Dogs" in event.Collections and "Cat Treats" in event.Collections

icon

Best answer by David To 13 September 2022, 21:28

View original

2 replies

Userlevel 7
Badge +60

Hey @jadebiscuit,

Loving your use case for this!

One of the great things about the show/hide function is that it allows for more than one logic condition. Because of this, I don’t think you using three pieces of logic would be a cause for the syntax error. That said, although using more than one condition wouldn’t directly cause the syntax error, it does open it up the likelihood to spelling errors which are common causes for an invalid syntax. Since conditional logic like this require exact matches and spelling, I would first recommend minor spelling mistakes or a leading or trailing spaces in your condition. 

With repeated conditions, we oftentimes like to copy and paste repetitive portions of the conditions. This in turn could lead to latent formatting being brought over when pasting which is another common cause for a syntax error. For this reason, we always highly suggest either manually entering/typing out the conditions or using the paste without formatting function. 

Sound like you’re pretty familiar with our show/hide function, but I’ll still include some resources below that could prove helpful - especially the ones written by our Template Specialist, @Anna McCarthy:

I hope this helps!

David

Userlevel 7
Badge +44

@jadebiscuit maybe a different way to solving the same problem but you could also have a split in the flow itself and have 3 different emails that are almost identical.

What you need to make sure of is that if someone buys multiple products it still shows something in the email. I have not gone through the mental exercise to run through the posible combinations but that's a good practice to do/test.

If you get a syntax error maybe removing parts of the logic to see if you can find the culprit.

 

Omar Lovert // Polaris Growth // Klaviyo Master Platinum Partner

Reply