Skip to main content
Solved

How to display unqiue products in a fulfilled orders dynamic content block

  • January 10, 2024
  • 1 reply
  • 90 views

Forum|alt.badge.img+1

Hello,

Isn’t there a way to remove duplicate products, or only show unique products, in an email using a dynamic content block from fulfilled orders?

I understand from some of the other submitted questions, that because each item is listed separately in the fulfilled orders table, they are displayed this way in the email. But surely there’s a custom script/code snippet we can use that would limit the products displayed to just unique product id’s?

I don’t see this scenario in your “Use conditionals in messages” topic, but I would think there is some “if item.0 = item.1, hide item.1” type code we could use. 

This is for 2 emails we’re working on implementing:

 - Write a Review email 

 - Restock email

So you can see why having the email display multiples of the same product would create a poor customer experience.

Please let me know.

Thank you in advance for your help.

 

Best answer by saulblum

Is this a custom HTML coded email, where you’re building the product block with the django template tagging syntax? If so, you could first sort the items array from the event using dictsort (say on product ID) and then use the ifchanged filter to only render the particular item’s block if the ID has changed from the previous loop iteration. This way, you wouldn’t have any duplicate product ID blocks.

View original
Did this topic or the replies in the thread help you find an answer to your question?

1 reply

Forum|alt.badge.img+7
  • Klaviyo Employee
  • 169 replies
  • Answer
  • January 11, 2024

Is this a custom HTML coded email, where you’re building the product block with the django template tagging syntax? If so, you could first sort the items array from the event using dictsort (say on product ID) and then use the ifchanged filter to only render the particular item’s block if the ID has changed from the previous loop iteration. This way, you wouldn’t have any duplicate product ID blocks.