我的表单上有些东西,但我无法修复它,按钮在有选择器时没有添加项目,在这种情况下是抓握带。请参阅此处显示link的链接:
<form
<p class="line-item-property__field">
<label>Griptape?</label><br>
<input required class="required" type="radio" name="properties[Griptape?]" value="Grip it for me"> <span>Grip it for me</span><br>
<input required class="required" type="radio" name="properties[Griptape?]" value="Just send the grip"> <span>Just send the grip</span><br>
</p>
<action="/cart/add" method="post" enctype="multipart/form-data" id="AddToCartForm">
<select name="id" id="productSelect" class="product-single__variants">
{% for variant in product.variants %}
{% if variant.available %}
<option {% if variant == product.selected_or_first_available_variant %} selected="selected" {% endif %} data-sku="{{ variant.sku }}" value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money_with_currency }}</option>
{% else %}
<option disabled="disabled">
{{ variant.title }} - {{ 'products.product.sold_out' | t }}
</option>
{% endif %}
{% endfor %}
</select>
<div class="product-single__quantity{% unless settings.product_quantity_enable %} is-hidden{% endunless %}">
<label for="Quantity">{{ 'products.product.quantity' | t }}</label>
<input type="number" id="Quantity" name="quantity" value="1" min="1" class="quantity-selector">
</div>
<button type="submit" name="add" id="AddToCart" class="btn">
<span id="AddToCartText">{{ 'products.product.add_to_cart' | t }}</span>
</button>
</form>
&#13;
非常感谢。
答案 0 :(得分:0)
固定。对于将来的任何人,这是更正后的代码:
<form action="/cart/add" method="post" enctype="multipart/form-data" id="AddToCartForm">
<p class="line-item-property__field">
<label>Griptape?</label><br>
<input required class="required" type="radio" name="properties[Griptape?]" value="Grip it for me"> <span>Grip it for me</span><br>
<input required class="required" type="radio" name="properties[Griptape?]" value="Just send the grip"> <span>Just send the grip</span><br>
</p>
<select name="id" id="productSelect" class="product-single__variants">
{% for variant in product.variants %}
{% if variant.available %}
<option {% if variant == product.selected_or_first_available_variant %} selected="selected" {% endif %} data-sku="{{ variant.sku }}" value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money_with_currency }}</option>
{% else %}
<option disabled="disabled">
{{ variant.title }} - {{ 'products.product.sold_out' | t }}
</option>
{% endif %}
{% endfor %}
</select>
<div class="product-single__quantity{% unless settings.product_quantity_enable %} is-hidden{% endunless %}">
<label for="Quantity">{{ 'products.product.quantity' | t }}</label>
<input type="number" id="Quantity" name="quantity" value="1" min="1" class="quantity-selector">
</div>
<button type="submit" name="add" id="AddToCart" class="btn">
<span id="AddToCartText">{{ 'products.product.add_to_cart' | t }}</span>
</button>
</form>