Learn how to add custom input fields to your checkout with Polar
By default, the Checkout form will only ask basic information from the customer to fulfill the order: a name, an email address, billing information, etc. But you might need more! A few examples:
A checkbox asking the customer to accept your terms
An opt-in newsletter consent
A select menu to ask where they heard from you
…
With Polar, you can easily add such fields to your checkout using Custom Fields.
Custom Fields are managed at an organization’s level. To create them, go to Settings and Custom Fields. You’ll see the list of all the available fields on your organization.Click on New Custom Field to create a new one.
The type of the field is the most important thing to select. It determines what type of input will be displayed to the customer during checkout.The type can’t be changed after the field is created.We support five types of fields:
This will display a simple text field to input textual data. By default, it’ll render a simple input field but you can render a textarea by toggling the option under Form input options.Under Validation constraints, you can add minimum and maximum length validation.Underneath, the data will be stored as a string.
This will display a number input field. Under Validation constraints, you can add minimum and maximum validation.Underneath, the data will be stored as a number.
This will display a date input field. Under Validation constraints, you can add minimum and maximum validation.Underneath, the data will be stored as a string using the ISO 8601 format.
This will display a select field with a predefined set of options. Each option is a pair of Value and Label, the first one being the value that’ll be stored underneath and the latter the one that will be shown to the customer.
The slug determines the key that’ll be used to store the data inside objects related to the checkout, like Orders and Subscriptions. It must be unique across your organization. You can change it afterwards, we’ll automatically update the data to reflect the new slug.The name is what we’ll be displayed to you to recognize the field across your dashboard. By default, it’ll also be the label of the field displayed to the customer, unless you customize it under Form input options.
Custom Fields are enabled on Checkout specifically on each product. While creating or updating a product, you can select the custom fields you want to include in the checkout for this product.Note that you can make the field Required.
If you make a checkbox field required, customers will have to check
the box before submitting the checkout. Very useful for terms acceptance!
The fields are now added as part of the Checkout form for this product.
Once you have added Custom Fields to your organization, they’ll be automatically displayed as a column in your Sales page, both on Orders and Subscriptions. From there, you’ll be able to see the data input by the customer.This data is also available from the Orders and Subscriptions API, under the custom_field_data property. Each value is referenced by the slug of the field.