Solved

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

  • 10 January 2024
  • 1 reply
  • 41 views

Badge

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.

 

icon

Best answer by saulblum 11 January 2024, 01:20

View original

1 reply

Userlevel 5
Badge +7

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.

Reply