我对Shopify很新,但我似乎无法调和为什么这两个片段产生相同的输出(即,产品总是使用特色图像,而不是我希望它们的第三个图像)< / p>
在:
{% assign featured_image = false %}
{% if collection.image %}
{% assign featured_image = collection %}
{% assign featured_image_alt = collection.image.alt | escape %}
{% elsif collection.products.first.featured_image %}
{% assign featured_image = collection.products.first.featured_image %}
{% assign featured_image_alt = collection.title | escape %}
{% endif %}
后:
{% assign featured_image = collection.products[1].images[2] %}
{% assign featured_image_alt = collection.image.alt | escape %}
这是使用featured_image的地方
<div class="list-image-wrapper">
{% if collection.empty? or featured_image == false %}
{{ 'collection-' | append: current | placeholder_svg_tag: 'placeholder-svg list-image' }}
{% else %}
<img
class="list-image"
src="{{ featured_image | img_url: '600x600' }}"
alt="{{ featured_image_alt | escape }}">
{% endif %}
</div>
答案 0 :(得分:0)
事实证明我正在编辑的文件是错误的,不再使用了。 &GT;。&LT;