Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
If anyone can help, that would be very appreciated.
I am building a store on the Spotlight theme and have the challenge that not all products having images.
So on collections, I want to make it so that if a product has no image there is a placeholder image that gets displayed instead.
In the product-card.liquid file the section that generates the product card, there's a check for the product's featured image
{%- if card_product.featured_media -%}
.... Display featured image....
{% endif %}
So I wedged a {% else %} in and copied all the code from the first if into the else statement.
under the else I used
{% assign placeholder = "product_placeholder.png" %}
and then replaced all the 'featured_image' references with {{ placeholder | asset_img_url: width: x }}
when inspecting, the image seems to pull through to the code correctly, but it still does not display?
Not sure how to check why the image is not showing, but would love some input that may help me resolve this
Hello @Nardu_M
Its Artzen Technologies! We will be happy to help you today.
PLease send me your store url, if applicable, the Password too.
Hi Artzen, here are the details for the store.
Store url: prestige-watch-wholesale.myshopify.com
password: rolexes
The file I've been editing is ../snippets/card_product.liquid
Generally there may be other logic that ends up controlling display in tandem with what you've edited.
Either externally or within the initial {% if %} condition.
Glancing over the url's code for /collections/all-products , NO media is loaded at all.
Double check the syntax of your image logic by validating it's parts in a custom-liquid block every step of the way, {{ placeholder}}etc etc.
If you need this debugged then contact me by mail for services, contact Info in signature.
Please always provide context, examples: store url, theme name, post url(s) , or any further detail.
Contact Info in signature.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Thank you Paul.
There was a conditional statement in one of the parent elements in the liquid code which prevented the images' display.
*The solution is not suitable to post on this forum
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025