--- title: 'Liquid tags: form' description: >- Generates an HTML `
``` ### cart ## Syntax ```oobleckTag {% form 'cart', cart %} form_content {% endform %} ``` Generates a form for creating a checkout based on the items currently in the cart. The `cart` form requires a [`cart` object](https://shopify.dev/docs/api/liquid/objects/cart) as a parameter. To learn more about using the cart form in your theme, refer to the [`cart` template](https://shopify.dev/themes/architecture/templates/cart#proceed-to-checkout). ##### Code ```liquid {% form 'cart', cart %} {% endform %} ``` ##### Output ```html ``` ### contact ## Syntax ```oobleckTag {% form 'contact' %} form_content {% endform %} ``` Generates a form for submitting an email to the merchant. To learn more about using this form in your theme, refer to [Add a contact form to your theme](https://shopify.dev/themes/customer-engagement/add-contact-form). *** **Tip:** To learn more about the merchant experience of receiving submissions, refer to \the Shopify Help Center\. *** ##### Code ```liquid {% form 'contact' %} {% endform %} ``` ##### Output ```html ``` ### create\_customer ## Syntax ```oobleckTag {% form 'create_customer' %} form_content {% endform %} ``` Generates a form for creating a new customer account. To learn more about using this form, and its contents, refer to the [`customers/register` template](https://shopify.dev/themes/architecture/templates/customers-register#content). ##### Code ```liquid {% form 'create_customer' %} {% endform %} ``` ##### Output ```html ``` ### currency ## Syntax ```oobleckTag {% form 'currency' %} form_content {% endform %} ``` *** **Deprecated:** The \currency\ form is deprecated and has been replaced by the \\localization\ form\.
***
Generates a form for customers to select their preferred currency.
***
**Tip:** Use the \\\\ filter\ to include a currency selector inside the form.
***
##### Code
```liquid
{% form 'currency' %}
{{ form | currency_selector }}
{% endform %}
```
##### Output
```html
```
### customer
## Syntax
```oobleckTag
{% form 'customer' %}
form_content
{% endform %}
```
Generates a form for creating a new customer without registering a new account. This form is useful for collecting customer information when you don't want customers to log in to your store, such as building a list of emails from a newsletter signup.
***
**Tip:** To generate a form that registers a customer account, use the \\\\ form\.
***
To learn more about using this form, and its contents, refer to [Email consent](https://shopify.dev/themes/customer-engagement/email-consent#newsletter-sign-up-form).
##### Code
```liquid
{% form 'customer' %}
{% endform %}
```
##### Output
```html
```
### customer\_address
## Syntax
```oobleckTag
{% form 'customer_address', address_type %}
form_content
{% endform %}
```
Generates a form for creating a new address on a customer account, or editing an existing one. The `customer_address` form requires a specific parameter, depending on whether a new address is being created or an existing one is being edited:
| Parameter value | Use-case |
| - | - |
| `customer.new_address` | When a new address is being created. |
| `address` | When an existing address is being edited. |
To learn more about using this form, and its contents, refer to the [`customers/addresses` template](https://shopify.dev/themes/architecture/templates/customers-addresses#content).
##### Code
```liquid
{% form 'customer_address', customer.new_address %}
{% endform %}
```
##### Data
```json
{
"customer": {
"new_address": {}
}
}
```
##### Output
```html
```
### customer\_login
## Syntax
```oobleckTag
{% form 'customer_login' %}
form_content
{% endform %}
```
Generates a form for logging into a customer account. To learn more about using this form, and its contents, refer to the [`customers/login` template](https://shopify.dev/themes/architecture/templates/customers-login#the-customer-login-form).
##### Code
```liquid
{% form 'customer_login' %}
{% endform %}
```
##### Output
```html
```
### guest\_login
## Syntax
```oobleckTag
{% form 'guest_login' %}
form_content
{% endform %}
```
Generates a form, for use in the [`customers/login` template](https://shopify.dev/themes/architecture/templates/customers-login), that directs customers back to their checkout session as a guest instead of logging in to an account. To learn more about using this form, and its contents, refer to [Offer guest checkout](https://shopify.dev/themes/architecture/templates/customers-login#offer-guest-checkout).
##### Code
```liquid
{% form 'guest_login' %}
{% endform %}
```
##### Output
```html
```
### localization
## Syntax
```oobleckTag
{% form 'localization' %}
form_content
{% endform %}
```
Generates a form for customers to select their preferred country so that they're shown the appropriate language and currency. The `localization` form can contain one of two selectors:
* A country selector
* A language selector
***
**Note:** The \localization\ form replaces the deprecated \\currency\ form\.
***
To learn more about using this form, and its contents, refer to [Support multiple currencies and languages](https://shopify.dev/themes/internationalization/multiple-currencies-languages).
##### Code
```liquid
{% form 'localization' %}
{% endform %}
```
##### Output
```html
```
### new\_comment
## Syntax
```oobleckTag
{% form 'new_comment', article %}
form_content
{% endform %}
```
Generates a form for creating a new comment on an article. The `new_comment` form requires an [`article` object](https://shopify.dev/docs/api/liquid/objects/article) as a parameter. To learn more about using this form, and its contents, refer to the [`article` template](https://shopify.dev/themes/architecture/templates/article#the-comment-form).
##### Code
```liquid
{% form 'new_comment', article %}
{% endform %}
```
##### Output
```html
```
### product
## Syntax
```oobleckTag
{% form 'product', product %}
form_content
{% endform %}
```
Generates a form for adding a product variant to the cart. The `product` form requires a [`product` object](https://shopify.dev/docs/api/liquid/objects/product) as a parameter. To learn more about using this form, and its contents, refer to the [`product` template](https://shopify.dev/themes/architecture/templates/product#the-product-form).
##### Code
```liquid
{% form 'product', product %}
{% endform %}
```
##### Data
```json
{
"product": {
"id": 6786188247105
}
}
```
##### Output
```html
```
### recover\_customer\_password
## Syntax
```oobleckTag
{% form 'recover_customer_password' %}
form_content
{% endform %}
```
Generates a form, for use in the [`customers/login` template](https://shopify.dev/themes/architecture/templates/customers-login), for a customer to recover a lost or forgotten password. To learn more about using this form, and its contents, refer to [Provide a "Forgot your password" option](https://shopify.dev/themes/architecture/templates/customers-login#provide-a-forgot-your-password-option).
##### Code
```liquid
{% form 'recover_customer_password' %}
{% endform %}
```
##### Output
```html
```
### reset\_customer\_password
## Syntax
```oobleckTag
{% form 'reset_customer_password' %}
form_content
{% endform %}
```
Generates a form for a customer to reset their password. To learn more about using this form, and its contents, refer to the [`customers/reset_password` template](https://shopify.dev/themes/architecture/templates/customers-reset-password#content).
##### Code
```liquid
{% form 'reset_customer_password' %}
{% endform %}
```
##### Output
```html
```
### storefront\_password
## Syntax
```oobleckTag
{% form 'storefront_password' %}
form_content
{% endform %}
```
Generates a form for entering a password protected storefront. To learn more about using this form, and its contents, refer to the [`password` template](https://shopify.dev/themes/architecture/templates/password#the-password-form).
##### Code
```liquid
{% form 'storefront_password' %}
{% endform %}
```
##### Output
```html
```
## form tag parameters
### return\_to
## Syntax
```oobleckTag
{% form 'form_type', return_to: string %}
content
{% endform %}
```
By default, each form type redirects customers to a specific page after the form submits. For example, the `product` form redirects to the cart page.
The `return_to` parameter allows you to specify a URL to redirect to. This can be done with the following values:
| Value | Description |
| - | - |
| `back` | Redirect back to the same page that the customer was on before submitting the form. |
| A relative path | A specific URL path. For example `/collections/all`. |
| A [`routes` attribute](https://shopify.dev/docs/api/liquid/objects/routes) | For example, `routes.root_url` |
##### Code
```liquid
{% form 'customer_login', return_to: routes.root_url %}
{% endform %}
```
##### Data
```json
{
"routes": {
"root_url": "/"
}
}
```
##### Output
```html
```
### HTML attributes
## Syntax
```oobleckTag
{% form 'form_type', attribute: string %}
content
{% endform %}
```
You can specify [HTML attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attributes) by adding a parameter that matches the attribute name with `data-` prepended, and the desired value.
##### Code
```liquid
{% form "product", product, id: 'custom-id', class: 'custom-class', data-example: '100' %}
{% endform %}
```
##### Data
```json
{
"product": {
"id": 6786188247105
}
}
```
##### Output
```html
```