2016-11-15 117 views
0

我添加了一條if語句到我的產品頁面,以便如果產品只有1個變體 - 通常是「默認標題」變體 - 不顯示任何,只是隱藏它。但由於某種原因,這已經打破了我的購物車按鈕?不太確定爲什麼?Shopify:購買按鈕不添加到包

 <form action="/cart/add" method="post" enctype="multipart/form-data"> 
     {% if product.options.size > 1 %} 
     <fieldset class="group"> 
      <ul class="checkbox"> 
      {% for variant in product.variants %} 
      {% if variant.available == true && %} 

        <li> 
        <label> 
        <input type="radio" value="{{variant.id}}" name="id" /> 
        {{ variant.title }} for {{ product.price | minus:variant.price | money_with_currency }} 
        </label> 
        </li> 
      {% else %} 
      {% endif %} 
      {% endfor %} 
      </ul> 
     </fieldset> 
     {% endif %} 
      <input type="submit" name="add" id="add" class="inpost-buy w-button" value="Add to Bag →"></input> 
     </form> 
+0

你的if語句不完整'{%if variant.available == true &&%}'爲什麼在沒有附加條件檢查時會出現'&&'? – drip

+0

刪除此操作仍會導致錯誤「參數丟失或無效:必需的參數丟失或無效:ID' – user3082823

回答

0

與variant.id參數的值的隱藏字段中缺少的else語句。

相關問題