product
Generate a product form.
Params
form_type{String}The type of the form, fixed to "product".product{Object}The product object.
Form Inputs
| Input | Type | Field Name | Required | Notes |
|---|---|---|---|---|
| Variant ID | text | id | Required | |
| Quantity | number | quantity | Required | Must be a positive integer |
Example
{{#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}}
Was this article helpful to you?