科裏它不是那麼複雜,如果我正確理解你想達到什麼。
我會使用訂單項屬性爲用戶提供4個下拉選擇,以便它可以在購物車中和後端訂單中顯示選擇。確保你閱讀了關於Line Item Properties,這樣你就可以明白它是如何工作的。但在這裏我想代碼應該看起來像你的product.liquid頁:
<label>Select slot 1</label>
<select id="slot1" name="properties[Slot1]">
<option value="Highlight/Filler Color: Linen" >Highlight/Filler Color: Linen</option>
<option value="Highlight/Filler Color: Sunlit" >Highlight/Filler Color: Sunlit</option>
<option value="Filler Type: Highlight/Filler Color: Wheat" >Filler Type: Highlight/Filler Color: Wheat</option>
<option value="Contour/Filler Color: Walnut" >Contour/Filler Color: Walnut</option>
... *add the rest of your options, total 10
</select>
<label>Select slot 2</label>
<select id="slot2" name="properties[Slot2]">
<option value="Highlight/Filler Color: Linen" >Highlight/Filler Color: Linen</option>
<option value="Highlight/Filler Color: Sunlit" >Highlight/Filler Color: Sunlit</option>
<option value="Filler Type: Highlight/Filler Color: Wheat" >Filler Type: Highlight/Filler Color: Wheat</option>
<option value="Contour/Filler Color: Walnut" >Contour/Filler Color: Walnut</option>
... *add the rest of your options, total 10
</select>
... *add the 2 other dropdown selections
請確保您還添加此代碼(它是在訂單項屬性解釋)添加到您cart.liquid頁:
{% for p in item.properties %}
{% unless p.last == blank %}
{{ p.first }}:
{% if p.last contains '/uploads/' %}
<a class="lightbox" href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
{% else %}
{{ p.last }}
{% endif %}
<br />
{% endunless %}
{% endfor %}
訂單項屬性只有在第四個選項與變體價格無關時纔有效。 – Sark 2014-12-06 19:12:45
@mycholan真的。儘管如果大多數選項的價格相同,您仍然可以使用訂單項屬性。當按下「添加到購物車」按鈕時,根據所選選項將正確的變體添加到購物車。請參閱[Shopify論壇上的此主題](https://ecommerce.shopify.com/c/ecommerce-design/t/adding-more-options-and-variants-42404#comment-42410)。在這種情況下,爲每個組合創建變體的選項過多,但如果大多數選項的價格相同(例如,只有1或2個更昂貴),則可以爲每個可能的價格組合創建變體。 – 2014-12-07 20:24:48