Re: Collection placeholder images - Spotlight theme

Collection placeholder images - Spotlight theme

Nardu_M
Shopify Partner
9 0 1

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

 

Replies 4 (4)

Artzen_tech
Shopify Partner
536 107 108

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.

If helpful, please Like and Accept this Solution to help others
Artzen Technologies | A Shopify Development Agency
WhatsApp - 9877983930

Book FREE CONSULTATION who want to migrate to Shopify or want to start an eCommerce business with Shopify
Nardu_M
Shopify Partner
9 0 1

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

PaulNewton
Shopify Partner
6419 585 1360

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.

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


Nardu_M
Shopify Partner
9 0 1

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