Liquid, JavaScript, themes, sales channels
I'd like to have some custom icons appear on the product page, like 1-year / 2-year warranty icon, 100% organic, etc. Is there a way to do this through the use of metafields.
Possible options I can think of:
I'd rather not have to use an app for this if possible. I'm new to Shopify development, so any help or insight on this would be greatly appreciated.
Solved! Go to the solution
This is an accepted solution.
You can use the settings for this. Keep in mind that this is an advanced topic, you'll need understanding of JSON and Liquid.
1. Go to settings.schema in your theme files
2. Add this code right at the bottom, don't forget a comma.
{
"name": "Custom settings",
"settings": [
{
"type": "image_picker",
"id": "custom-image",
"label": "Image"
}
]
}
3. Now upload any image at the theme settings > custom settings that we just created:
4. You can access this image now anywhere in your theme simply using {{settings.custom-image}}. Try adding this to your product-template.liquid for the sake of testing:
{% if settings.custom-image != blank %}
<img src="{{ settings.custom-image | img_url: 'master' }}"
alt="{{ settings.custom-image.alt | escape }}" />
{% endif %}
Let me know whether it works.
@diego_ezfy I tried your solution, but I don't see the image I uploaded. I'm not sure how it would get that image, maybe I'm missing something. Should I have named the image something specific?
you have to upload the image again by clicking on the custom settings button
facepalm... I can see the image. Now to get it on the right product.
This is an accepted solution.
Hi,
The content was archived. Does anyone have a solution?
Thank you
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024