How to target part of product description?

Topic summary

Main topic: Localizing only the shipping section within a Shopify product description using Liquid, based on country and locale.

Context: In main-product.liquid, the description block renders product.description. The author can detect request.locale.iso_code and localization.country.iso_code. The product.description is a single HTML/Rich Text blob, with a “##### SHIPPING” heading followed by “Shipping info.”

Goal: For en-US, replace only the shipping segment with custom US shipping info, while keeping the rest of the description unchanged. Ideally apply per product, per country, per locale, without duplicating entire descriptions.

Challenge: Difficulty targeting just the shipping subsection within product.description using Liquid, since it’s rendered as one block. Current code uses a replace filter for an attribute but not for content sections.

Artifacts: Code snippets are central to understanding (Liquid rendering of description, conditional locale/country checks, desired conditional replacement logic).

Status: No resolution provided; the key question remains open on how to select and replace only the shipping portion within product.description via Liquid.

Summarized with AI on February 12. AI used: gpt-5.

I’m trying to translate the shipping section in my product description based on country and locale.

I already figured out how I can check for the country (localization.country.iso_code) and locale (request.locale.iso_code), but now I’m having issues targeting the part of my product description regarding shipping.

In main-product.liquid I have this part which is interesting to me:

{%- form 'product', product, class: 'ProductForm' -%}
    {%- render 'product-data', product: product -%}

    {%- for block in section.blocks -%}
      {%- case block.type -%}
        {%- when '@app' -%}
          {%- render block -%}

        {%- when 'product_meta' -%}
          {%- render 'product-meta', form: form, block: block, product: product -%}

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

                {{- product.description | replace: 'data-section-type', 'data-section-type-placeholder' -}}
              

            

My idea was to check for language and locale there, but I’m having issues targeting shipping, since the generated code for product.description looks like this:


    

Product Number One

    

Produt Number One Info

    

Dimensions...

    

Volume...

    ##### Fabrics...
    ##### SHIPPING
    

Shipping info

How can I set up my liquid code to achieve the the following but have only the shipping info change:

{%- if request.locale.iso_code == 'en' -%}
  {%- if localization.country.iso_code == 'US' -%}
    
      

Product Number One

      

Produt Number One Info

      

Dimensions...

      

Volume...

      ##### Fabrics...
     ##### SHIPPING
    

US Shipping info

  {%- elsif localization.country.iso_code == 'JP' -%}
...

This will change the English translation only for Product Number One, for US market only. I would have to do it for each product, for each country and for each locale.

Is there a way to select only the shipping section in product.description?
Ideally my could would look like this:

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

        {%- if request.locale.iso_code == 'en' -%}
          {%- if localization.country.iso_code == 'US' -%}
            ##### Shipping
              Custom US shipping info.
       {%- elsif -%}
         {{- product.description | replace: 'data-section-type', 'data-section-type-placeholder' -}}