如何在 Shopify 的下拉菜单中添加 product-title 列表?
How to add product-title list in dropdown menu on Shopify?
我在 Shopify 商店中有多种产品,所以我在购买时只创建了一个下拉菜单。但我不知道如何按标题 select 产品的正确代码。
<label for="{{ formId }}-product-one">Select product*</label>
<select>
{% for value in product_option.values %}
<option {% if product_option.selected_value == value %}selected{% endif %}>
{{ value }}
</option>
{% endfor %}
</select>
如果我有多个下拉菜单怎么办。当一种产品在一个选项中被 select 编辑时,它将在第二个选项中被禁用。
这就是我需要的。
<label for="{{ formId }}-product-one">Select product*</label>
<select>
{% for product in collections['all'].products %}
<option value="{{ product.title }}">{{ product.title }}</option>
{% endfor %}
</select>
我在 Shopify 商店中有多种产品,所以我在购买时只创建了一个下拉菜单。但我不知道如何按标题 select 产品的正确代码。
<label for="{{ formId }}-product-one">Select product*</label>
<select>
{% for value in product_option.values %}
<option {% if product_option.selected_value == value %}selected{% endif %}>
{{ value }}
</option>
{% endfor %}
</select>
这就是我需要的。
<label for="{{ formId }}-product-one">Select product*</label>
<select>
{% for product in collections['all'].products %}
<option value="{{ product.title }}">{{ product.title }}</option>
{% endfor %}
</select>