form
Renders an HTML form for a storefront action.
Outputs <form> with the right action and hidden fields. Supported types: product, cart, contact, customer, newsletter, customer_login, create_customer, recover_customer_password, reset_customer_password, activate_customer_password, customer_address, guest_login, localization, storefront_password, currency, new_comment. Inside, form gives errors and posted_successfully?. Other parameters become attributes; return_to sets where to go after.
Syntax
Section titled “Syntax”{% form 'product', product, class: 'product-form' %}…{% endform %}Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
type (required) |
string | Form type. |
object |
object | The product (product form), article (new_comment) or address. |
return_to |
string | Path to redirect to after a successful post. |
Example
Section titled “Example”{% form 'contact', class: 'contact' %}<input name="contact[email]">{% endform %}<form method="post" action="/contact" id="form-contact" accept-charset="UTF-8" class="contact"><input type="hidden" name="form_type" value="contact"><input type="hidden" name="utf8" value="✓"><input name="contact[email]"></form>Related
Section titled “Related”Compatibility
Section titled “Compatibility”Shopify: Same as Shopify.
Since theme platform 1.0.
Was this page helpful?

