Solved

Removing HTML text from Abandoned Cart product link

  • 4 January 2021
  • 5 replies
  • 605 views

Badge +2

I’m not sure why the HTML is showing up in the hyperlink text for the product link in the ‘abandoned cart’ email… the text included in the email template is {{ item.product.title }}

Attaching an image for how it appears when email is received.  If anyone can suggest why this is happening, and how to resolve please do let me know!

 

 

icon

Best answer by retention 9 January 2021, 00:50

View original

5 replies

Userlevel 7
Badge +57

@cluch - Most likely, if there’s HTML it’s because it’s in the actual product name in your ecommerce platform.  Since they are interpreted on the website, you don’t see them.  But when they are used in an email template, then they show.  Ideally, you should not have styling/markup in your CMS and adjust them in the template instead.  

However, a quick around is to use a “Filter” that can strip all the HTML tags like this:

{{ item.product.title | striptags }}

Give that a shot and let us know if it worked!

Badge +2

Hi there,

 

I am having a similar problem in the Replenishment Reminder/Buy Again flow, that doesn’t seem to work upon implementing the ‘filter’ you suggested.  I’m wondering if there’s another type of workaround? 

 

Also, when I try to save the component I’m getting the following error notice :

 

 

Let me know if you have any suggestions for resolving. Thank you! 

Userlevel 7
Badge +57

@cluch - Can you click on the “Source” button and copy/paste what you have there? 

 

The “Filter” should work to remove any HTML tags that might be present in your “title”- in your example, I don’t see you added the filter.  {{ item.product.title }} should be replaced to look like this:

{{ item.product.title | striptags }}

 

Badge +2

Added the filter.

 

 

Here is source:

 

<p><a href="{{ organization.url }}products/{{ item.product.handle }}">{{ item.product.title | striptags }}</a></p>

<p>Quantity: {{ item.quantity|floatformat:0 }}<br />
Total: ${{ item.line_price|floatformat:2 }}</p>

<p><span style="font-family:new york,georgia,serif;"><a href="{{ organization.url }}/cart/{{ item.variant_id }}:{{ item.quantity|floatformat:'0' }}"><img src="https://d3k81ch9hvuctc.cloudfront.net/company/B2tYas/images/d21bbd59-3287-4287-b745-8cc32c013180.png" width="125px" /></a></span></p>
 

 

 

Userlevel 7
Badge +57

@cluch Hmmm, that seems correct.  I tested it and I didn’t get that error. Here’s what I used, make sure to copy this and paste it in “Source” and not “Text” of the text portion of your Table Block.

<p><a href="{{ organization.url }}products/{{ item.product.handle }}">{{ item.product.title|striptags }}</a></p>

<p>Quantity: {{ item.quantity|floatformat:0 }}<br />
Total: ${{ item.line_price|floatformat:2 }}</p>

<p><span style="font-family:new york,georgia,serif;"><a href="{{ organization.url }}/cart/{{ item.variant_id }}:{{ item.quantity|floatformat:'0' }}"><img src="https://d3k81ch9hvuctc.cloudfront.net/company/B2tYas/images/d21bbd59-3287-4287-b745-8cc32c013180.png" width="125px" /></a></span></p>


Also, remember to click “Save” while you’re in the Table Block, refresh your browser (just in case) and then click on “Preview” to see if it worked. 

Reply