product
生成 product 表单
参数
form_type{String}form 的类型,固定为 productproduct{Object}产品对象
表单输入
| 输入项 | 输入类型 | 字段名 | 是否必填 | 备注 |
|---|---|---|---|---|
| 变体id | text | id | 必填 | |
| 数量 | number | quantity | 必填 | 必须为正整数 |
例子
{{#form "product" product id="productFrom" class="productFrom"}}
<div style="margin-bottom:10px;">
<input type="number" required step="1" form="product-form-{{section.id}}" name="quantity" min='1' max='999' value='1'/>
</div>
<div style="margin-bottom:10px;">
<input type="hidden" name="id" value="{{default product.selected_or_first_available_variant.id (get 'id' (first product.variants))}}" />
</div>
<button style="margin-bottom:10px;" class='btn btn-primary' type='submit'>{{ t 'products.product_list.add_to_cart' }}</button>
{{ payment_button }}
{{/form}}
这篇文章对你有帮助吗?
SHOPLINE