In the previous examples we've built a number of different checkout forms utilizing MemberMouse's checkout form SmartTags to collect standard account, billing and shipping information. In some cases there may be additional data that you're interested in collecting from customers that's specific to your business. For example, if you're running a weight loss program you may want to collect a customer's current and target weight.
MemberMouse allows you to create custom fields in order to associate additional data with each member's account. Custom fields are identified by the ID assigned to them in MemberMouse. In the following examples we'll show you how to collect custom information through a checkout form.
Collect Data with Standard Input Fields
The MM_Form_Field
SmartTag natively supports collecting custom field data through a standard HTML input form field. To do this you just need to set the type
attribute to custom
and set the id
attribute to the ID of the custom field you're collecting data for. Optionally, you can set the isRequired
attribute to indicate whether the field is required to be filled out or not. By default, custom fields are not required to be filled out by the customer. Here's an example:
Current Weight: [MM_Form_Field type='custom' id='1' isRequired='true'] Target Weight: [MM_Form_Field type='custom' id='2' isRequired='false']
Collect Data with Hidden Fields
The MM_Form_Field
SmartTag natively supports collecting custom field data through a hidden HTML input form field. To do this you just need to set the type
attribute to custom-hidden
and set the id
attribute to the ID of the custom field you're collecting data for. Here's an example:
[MM_Form_Field type='custom-hidden' id='3']
Since this form field is hidden the customer won't be able to interact with it directly, so hidden custom fields are only useful when used in conjunction with passing custom field data to the checkout form through the URL. A common scenario where hidden custom fields would be used is if you have a pre-registration questionnaire you want customers to fill out. In this scenario the customer fills out a pre-registration form (see our Create a 2-Step Checkout Process article) and then that data gets passed to the checkout form. This data is then stored in the hidden custom fields and when the customer submits the checkout form the data will be saved and associated with their account.