I need some help. I have a site I’m working on for a client using Shopify.
The site needs a banner for each collection page, based off of the collection image uploaded when creating the collection.
I was told I could use this code to do this…
{% if collection.image %}{{ collection.image | img_url: 'medium' }}{% endif %}
I’ve looked around the Shopify code edit section, and I checked the collection.liquid code in the template section, but didn’t see a place to add this code. Then I checked the collection-template.liquid part in the section part, but I still don’t see a place that would make sense to add it.
Where should I add this code?
I’m not familiar with the Shopify Liquid code system. I only know how to code HTML and CSS.
If it helps, I’m using the Everything Main Theme.
2
Answers
I couldn’t find a theme called “Everything Main”, but I can show you how to it with one of the free ones. In this example, I’m using “Supply”.
So, first of all you open the /sections/collection-template.liquid file and look for this code:
This shows the collection description in case it isn’t blank. Now if you wanted to show the collection image, this snippet would look something like this:
So in case the image isn’t blank, a container is inserted which includes your image.
Roman