Product Template - Remove Images

Topic summary

Goal: Hide product images only on selected product templates (previously hidden site‑wide via CSS).

Proposed approach: Add a Liquid conditional in theme.liquid and wrap the image‑hiding code inside it. Steps: Online Store → Edit code → theme.liquid → insert a condition before :

  • {% if template == ā€˜your-template’ %} …image‑hiding code… {% endif %}

Multiple templates: The attempted single IF using ā€œandā€ failed. Suggested solution: use separate IF blocks for each template, e.g.:

  • {% if template == ā€˜product.drug-testing’ %} … {% endif %}
  • {% if template == ā€˜product.dna-testing’ %} … {% endif %}

Notes:

  • Code snippets are central; the exact CSS/markup to remove images is assumed to be the same as the prior site‑wide method, now placed inside the condition(s).
  • The thread focuses on Liquid condition usage, not on the specific CSS selector to hide images.

Status: Guidance provided on scoping by template and handling multiple templates with separate conditionals. No confirmed resolution from the original poster; key open point is implementing the actual image‑hiding code within those condition blocks.

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

Is there a code snippet that can remove product images from a defined product template?

Previously we used:


Which removes the product images at the site wide level, I want to be able to display products on defined template now however. Can this be modified to accommodate?

Hey @theworldfamous

Follow these Steps:

  1. Go to Online Store

  2. Edit Code

  3. Find theme.liquid file

  4. Add the following code in the bottom of the file above tag

{% if template == 'your-template' %}

{% endif %}

NOTE: Replace ā€œyour-templateā€ with the name of your template and it should be good.

If I managed to help you then, don’t forget to Like it and Mark it as Solution!

Best Regards,
Moeed

1 Like

This line of code works, is it able to work on multiple product themes I apply it to? I wrote it like this in the example for the two templates I want to show no product images, however it fails.


          {% if template == 'product.drug-testing' and 'product.dna-testing' %}
          

{% endif %}

Hey @theworldfamous

You can try this code instead

{% if template == 'product.drug-testing'%}        

{% endif %}
{% if template == 'product.dna-testing'%}        

{% endif %}

If I managed to help you then, don’t forget to Like it and Mark it as Solution!

Best Regards,
Moeed

1 Like