Created
March 1, 2012 01:45
-
-
Save bradjmiller/1946527 to your computer and use it in GitHub Desktop.
Display associated image of product variant in cart.liquid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="{{ item.product.url }}" title="{{ item.product.title | escape }}"> | |
{% assign found = false %} | |
{% for img in item.product.images %} | |
{% if found == false and item.variant.title contains img.alt %} | |
<img src="{{ img | product_img_url: 'thumb' }}" alt="{{ item.alt | escape }}" /> | |
{% assign found = true %} | |
{% endif %} | |
{% endfor %} | |
{% if found == false %} | |
<img src="{{ item.product.featured_image | product_img_url: 'thumb' }}" alt="{{ item.product.featured_image.alt | escape }}" /> | |
{% endif %} | |
</a> |
Hey Brad,
New to all this coding, but have a good understanding. Are we just adding this code to the cart.liquid? or are we removing some code and replacing it with this? Your help would be amazing. Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This snippet can replace the product thumbnail image in cart.liquid