Hi there, i was able to add code and hide the first image on the product page, so any product images that has the alt text ‘hide-on-product-page,’ is hidden on *product page only.
Now when i add to cart, the first image that is hidden shows on the cart page? How can i hide the first image on cart page also?
Thank you in advance.
Hi @crepscity
Do you want to remove the product imag in the cart drawer or to replace it with other image?
Please let me know your requirement in detail.
Hi @crepscity
Go to Online store > Themes > Edit code, open cart-drawer.liquid and main-cart-items.liquid files,find this code
Replace it with this code
{% if item.product.images.size > 1 %}
{% else %}
{% endif %}
Hi Dan, ive tried your solution and nothing happened?
Hi Vinh0225,
Yes, if able, replacing the product image with other images like showing the second image of that product could work, or hiding the specific image using alt text targeting could be a solution. Here are the specific requirements:
-
Mini Products for Homepage Only: The mini products are designed for homepage display only.
-
Hide Image on Product Page: When a customer clicks into a mini product, I have already hidden the first image using the alt text to target ‘hide-on-product-page.’
-
Replace Product Image: I would like to replace the default product image in the cart drawer with other images or hiding the first image and showing the second image of that certain product and not targeting all products.
-
Hide Image Using Alt Text: On the cart page, I want to hide a specific image using alt text targeting as this way worked on hiding the first product images on the product page or if you have other solutions you may have that may work.
-
Hide Image in Search Bar: Additionally,I want to also hide the first image using the alt text on the search bar as it currently shows the default image first or if you have other solutions that may work.
Please let me know how to achieve these requirements.
I have shared photos below for your reference.
Could you share your store link and screenshot where you added the code?
Store link: crepscity.com
Added Code below:
Also, i cannot find the cart-drawer.liquid file on the dawn theme, only the main-cart-items.liquid?
You added code to change image in cart page, did not add code in cart-drawer.liquid
I stated above, i cannot find the cart-drawer.liquid file on the dawn theme? is there maybe a different name as im using the dawn theme?