Adding an image to the sidebar on a specific product (on main product page)

Adding an image to the sidebar on a specific product (on main product page)

Marl_goyogi
Visitor
2 0 0

Hi - I'm in need of help with this simple liqued code.
I want to add an image (GOTS logo) on some of my products (not all are GOTS certified).
I have tagged the product with; show-gots-logo

Then, in the main-product.liquid I have inserted this code under the collapsible content section of my product sidebar.

 

{% if product.tags contains 'show-gots-logo' %}
  <div class=\"gots-logo\">
    <img src=\"https://cdn.shopify.com/s/files/1/0234/8013/files/show_gots_product.png?v=1746605466\" alt=\"GOTS Certified\">
  </div>
{% else %}
  <p>Tag not found</p>
{% endif %}

 I have tested the img link and it is fine. The code shows up on my product, so it almost works, but how do i get to display the img ? (Only testing on a single product).

code liq.pngerror on product.png
Hope someone can help me 🙂 

Thanks 

Marlene 

Replies 2 (2)

oscprofessional
Shopify Partner
16373 2440 3188

Hi Marlene 👋 

Try this corrected code:

{% if product.tags contains 'show-gots-logo' %}
<div class="gots-logo">
<img src="https://cdn.shopify.com/s/files/1/0234/8013/files/show_gots_product.png?v=1746605466" alt="GOTS Certified" />
</div>
{% endif %}
This will display the GOTS logo only for products tagged with show-gots-logo. No need for backslashes inside HTML tags in Liquid files.

Hire us | Pass Core Web Vital | B2B Wholesale Experts | Claim Your Free Website Review |
Connect with Us: WhatsApp | Skype: oscprofessionals-87 | Email: pallavi@oscprofessionals.com |
Custom Shopify SolutionsPrivate Apps, Theme Customization & SEO | Digital Marketing |
OSCP Apps: Discount Suite | Wholesale App | Bundle & Upsell | Shipping Discount | and more...
Marl_goyogi
Visitor
2 0 0

Thank you SO MUCH! Now it works! 😀