Changing product page title (ONLY)

Topic summary

Goal: Change the title for a single product page to “Hygia Dental cleaning tablets - 30 Tablets” without altering the product title elsewhere (e.g., collections).

Approach: Edit the theme code in Online Store → Themes → Edit code. In main-product.liquid, locate where the product title is rendered and wrap it in a Liquid conditional by product.id.

Implement: If product.id == 7748266754148, output the hardcoded title; otherwise, render {{ product.title | escape }}. This targets only that product’s page and leaves all others unchanged.

Issue & fix: The first snippet caused extra titles on other product pages due to a mistake (typo/missing code). A corrected conditional was provided, resolving the duplication.

Assets: Screenshots illustrate file location and the replacement snippet; the code block is central to the solution.

Outcome: The corrected code works as intended. Status: Resolved; no open questions.

Summarized with AI on December 21. AI used: gpt-5.

How can I change my product page title from Sterilization tablets to ‘Hygia Dental cleaning tablets - 30 Tablets’?
I would like this to be done only on the product page and not in the actual product linked to collections page.

Thank you in advance guys!

url: hygiadental.com
pw: melek

Hi @Anonymous ,

It requires some code to achieve your requirement. You can follow these instructions.

Step 1: Go to Online Store → Theme → Edit code.

Step 2: Find the file main-product.liquid, and locate the code snippets I’ve marked here.

Step 3: Replace it by this code:

{% if product.id == 7748266754148 %}
    # Hygia Dental cleaning tablets - 30 Tablets
    
      ## Hygia Dental cleaning tablets - 30 Tablets
    
 {% else %}
    # {{ product.title | escape }}
    
      ## {{ product.title | escape }}
    
 {% endif %}

Like this

I hope these instructions will help you. If they are helpful, please give us likes and mark as the solution.

Have a nice day!

Hi, I put this into my code and I now have extra titles on the other 2 product pages.

@Anonymous , I’m really sorry, I missed some code. Here is the correct version :sad_but_relieved_face:


{% if product.id == 7748266754148 %}
    # Hygia Dental cleaning tablets - 30 Tablets
    
      ## Hygia Dental cleaning tablets - 30 Tablets
    
 {% else %}
    # {{ product.title | escape }}
    
      ## {{ product.title | escape }}
    
 {% endif %}

beautiful thankyou sir!

1 Like