How can I substitute an HTML tag in my product descriptions without editing each one?

Topic summary

A store owner with 13,700+ products needed to replace <hr> tags in product descriptions with custom styled divs to adjust spacing, but wanted to avoid manually editing each item.

Solution Found:
The user successfully implemented a Liquid template solution in the main-product.liquid file that:

  • Uses {% assign newSplitText = product.description | split: '<hr>' %} to divide descriptions at <hr> tags
  • Outputs the first section, then inserts the custom div styling between sections
  • Handles cases where no <hr> tags exist using conditional logic ({% if newSplitText[1] != blank %})

Outcome:
The issue is resolved. The template-level substitution automatically applies the new styling across all products without requiring individual edits, replacing the default <hr> spacing with a custom div featuring specific margin and border properties.

Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

In all of my 13700+ product descriptions I have an


html tag. The problem is spacing, it is just to far apart between the text sections so I wanted to change the
to this.

But, what I want to do is instead of editing 13700+ items is sub the


in the main-product.liquid section where it prints the description. This is the code I have now:

{%- when ‘description’ -%}
{%- if product.description != blank -%}

Description
{{ product.description }}
{%- endif -%}

So I need it to sub the

code above for the
in the product.description string right before it prints it out.

1 Like

Actually I figured it out :slightly_smiling_face:

New code:

{%- when ‘description’ -%}
{%- if product.description != blank -%}

{% assign newSplitText = product.description | split: ‘


’ %}

Description
{{ newSplitText[0] }}
{{ newSplitText[1] }}
{%- endif -%}

Even better, handles the instances when there no


's

{{ newSplitText[0] }} {% if newSplitText[1] != blank %}
{{ newSplitText[1] }} {% endif %}