Hey guys, I’ve noticed this seems to be a big issue in the community. I know Shopify has put out a tutorial for this but it just doesn’t work for a lot of people, myself included.
Here’s the solution that worked for me. I was able to find these solutions from a couple of different people within this thread. I just wanted to post the full, cleaned-up versions here to hopefully make it easier for folks to find and implement.
I use the Debut theme but I’ve seen others say it worked for them using other themes as well. I don’t know anything about code so I won’t be able to help you troubleshoot things but hopefully others will.
*Please be sure to duplicate your theme and try this code out on a copy of your theme before you implement it on your live theme just so you can see that everything works as it should.
Step 1
Copy and paste this at the end of your theme.css.liquid (or .scss.liquid) file:
/* ===============================================
// Reveal module
// =============================================== */
.has-secondary.grid-view-item__link img.secondary{
display:none;
}
.has-secondary.grid-view-item__link:hover img.secondary{
display:block;
}
.has-secondary.grid-view-item__link:hover img.grid-view-item__image{
display:none;
}
@media screen and (min-width:767px){
.has-secondary.grid-view-item__link img.secondary{
display:none;
}
.has-secondary.grid-view-item__link:hover img.secondary{
display:block;
}
.has-secondary.grid-view-item__link:hover img.grid-view-item__image{
display:none;
}
}
@media screen and (max-width:767px){
.has-secondary.grid-view-item__link img.secondary{
display:none;
}
}
.grid-view-item__title {
margin-top: 10px;
}
Step 2
Next, replace all the code in product-card-grid.liquid file with this:
{% unless grid_image_width %}
{%- assign grid_image_width = '600x600' -%}
{% endunless %}
{% if product.images.size > 1 %}
{% endif %}
{{ product.title }}
{% if section.settings.show_vendor %}
{{ product.vendor }}
{% endif %}
{% include 'product-price', variant: product %}
This will display your last image on hover, you can replace product.images.last with product.images[1] if you want the second photo to display instead.
Thanks guys!