Skip to main content

Hi guys, 

I am setting up a back in stock flow and was wondering how I could add the product description. 

I am using the following code, which pulls the description dynamically from the catalogue.

{% catalog event.VariantId integration='shopify' %}{{ catalog_item.description }}{% endcatalog %}

However, the description includes HTML tags (see Screenshot). What do I have to do, to remove them?

 

Thanks

Hendrik

Hi @NextLevel 

Thank you for posting your question in the community. 

While I have not specifically run into this challenge I wanted to chime in and see if I could help point you in the right direction to get the HTML tags removed. 

Klaviyo uses django web framework. When I create custom code to format shopify data I reference the Django documentation frequently. 

https://docs.djangoproject.com/en/5.0/ref/templates/builtins/

In your case, there is a condition called Striptags which is supposed to remove HTML tags from a block of text. 

I am not an expert in Django, but play around with it, I think if you add the following to your code, it could do the trick.

{{ value|striptags }}

{% catalog event.VariantId integration='shopify' %}{{ catalog_item.description|striptags }}{% endcatalog %}

 

Please let me know if that does the trick!

@In the Inbox 


@In the Inbox thanks for your answer.

It works, but then there are no blank spaces between sentences and no paragraphs 😃

Any idea how to solve this?

 


We dont whant to strip the html but to insert the html.

 

Please help!


Hi @Enelclavo 

Thank you for the follow up. While the initial goal of remove the HTML tags for the content did work, I am sorry to see it’s completely removed the formatting from the email. I’d be curious if any of the other Champions might have an idea here to help @Bobi N. @Omar @retention

@In the Inbox 


Reply