"Image" section in the Dawn theme product template.

3 0 0

I'm using the dawn theme and I want to add an image section in the product template which can show the image from metafields on the product page.
However, In the editor, product template, I can't find the "Image" section. Can someone help me?


image section.png

Reply 1 (1)

1245 113 149
  1. Create a new section called "custom-image-section.liquid".
  2. In the newly created section file, add the following code:


{% if product.metafields.custom_fields.image %}
  <img src="{{ product.metafields.custom_fields.image | img_url: 'medium' }}" alt="Custom Image">
{% endif %}


  1. Save the section file.

Now, you need to include this custom image section in your product template:

  1. In the left sidebar, under "Sections", locate the "product-template.liquid" file and click on it.
  2. Find the appropriate location in the product template where you want to display the image section.
  3. Add the following code at that location:


{% section 'custom-image-section' %}