我Shopify的收藏页上的色板 [英] Color swatch on collections page I Shopify

查看:80
本文介绍了我Shopify的收藏页上的色板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一家shopify商店,并且在我的shopify集合页面上添加了一个色板调色板.

I have a shopify store and I added a color swatch palette to my shopify collections page .

如何仅显示库存中的颜色?

http://gloria22x.myshopify.com/collections/alle-produkte?sort_by = manual

谢谢亚历克斯

{% for option in product.options %}
{% if option == 'Color' %}
{% assign index = forloop.index0 %}
{% assign colorlist = '' %}
{% assign color = '' %}
{% for variant in product.variants %}
{% capture color %}
{{ variant.options[index] }}
{% endcapture %}
{% unless colorlist contains color %}
<img class="colorpalette" src="{{ color | downcase | strip_newlines | strip_html | replace:'ß','ss' | remove: ' ' | append: '.png' | asset_url }}" title="{{ color | camelize }}" alt="{{ color | camelize }}" width="16" height="16"/>
{% capture tempList %}
{{colorlist | append: color | append: ‘ ‘}}
{% endcapture %}
{% assign colorlist = tempList %}
{% endunless %}
{% endfor %}
{% endif %}
{% endfor %} 

推荐答案

您需要检查 inventory_quantity .试试这个:

You need to check the inventory_quantity for each variant. Try this:

...
{% for variant in product.variants %}
    {% if variant.inventory_quantity > 0 %}
        ...
    {% endif %}
{% endfor %}
...

这篇关于我Shopify的收藏页上的色板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆