Solved

How can I Show/Hide different buttons depending on different tracking carriers?

  • 13 October 2021
  • 1 reply
  • 19 views

Badge

Looking to see if we can show various buttons based on shipping carriers. My guess is this needs to be done in the dynamic content dialogue box, but I don’t see any contains logic in the documentation. Is the below possible?

The buttons will split between UPS tracking and FedEx Tracking. We'd like to say:

When {{ event.Deliveries.0.carrier }} contains FEDEX - show FEDEX button

When {{ event.Deliveries.0.carrier}} contains UPS - show UPS button

icon

Best answer by Taylor Tarpley 13 October 2021, 20:56

View original

1 reply

Userlevel 4
Badge +5

Hi @Jo Erickson

 

Thanks for sharing your question with us! 

 

Yes, your guess is correct as you would need to do accomplish this using dynamic content that would display a different block depending on which carrier data was present. The best way to accomplish this would be to use Show/Hide Template Blocks based on the Dynamic Variables. You would create two button blocks in your email and click on the question mark at the top of each the block, inserting the relative data. Shown below: 

 

 

Your code was almost correct! However, you do not need the ‘ .0 ’ in your code as that number signified it is the first data field in an array. This isn’t an array, but will only be one of two choices depending on which data is present. Additionally, you would use the equal sign instead of ‘contains’ as the sign signifies that this block will be shown if the the criteria is met. Finally, the data, or ‘answer’, that is analyzed will need to go in quotation markets to fit the proper coding. 

 

For your Fedex button the inserted code would read:

 

{{ event.Deliveries.carrier }} = ‘FEDEX’ 

 

For your UPS button the inserted code would read:

{{ event.Deliveries.carrier }} = ‘UPS’ 

 

In closing, here are some additional community posts on Show/Hide Blocks that I’d recommend checking out to gain more insight!

 

Thanks for being a part of the Community! 

-Taylor 

 

Reply