MMv4 KB
 
Making Required Storefront Fields Optional
  Last Edited - 03/29/2013 1:23pm PDT
  Category Path - Shopping Cart Software Components > Administration Area > Design
 
fewer required checkout fields
"Due to the nature of the products I sell, I don't need to collect the customer's address information. However, these are required fields on my store's checkout page. Is it possible to either remove the address fields or, at least make them optional?"
— Optional in Omaha

When a customer places an order in your online store, their contact information is collected during the checkout process. Makes sense, since most stores will need this information to not only bill and ship the order, but also contact the customer if necessary.

But what if your store doesn't need all this information? For example, what if you're selling downloads, and you only need their name minimal contact information? Is there a way to reduce the amount of fields that the customer must fill out during the checkout process, or at least make some of those fields optional? The answer is yes, both of those approaches are possible. The following tutorial will explain how.

prerequisites
This tutorial assumes that the reader already has a basic understanding of how to build a webpage; including working with HTML source code, and creating links, tables, CSS styles and images.

Basic familiarity with the concept of the shopping cart software's template system and QuickCode Tags is also recommended.
 
Required Fields

The following QuickCode Tags will create form fields, such as a text field in which to enter your name. Any of these fields that are present on a storefront page (such as the checkout page), will be required by default.

Field QuickCode Tag
Billing First Name {FIELD-BILL-FIRST-NAME}
Billing Last Name {FIELD-BILL-LAST-NAME}
Billing Address Line 1 {FIELD-BILL-ADDRESS-1}
Billing City {FIELD-BILL-CITY}
Billing State
Only required if the selected country has states or provinces.
{FIELD-BILL-STATE}
Billing Zip
Only required if the selected country has zip or postal codes.
{FIELD-BILL-ZIP}
Billing Country {FIELD-BILL-COUNTRY}
Phone Number {FIELD-PHONE-NUMBER}
Phone Number's Area Code {FIELD-PHONE-AREA-CODE}
Shipping First Name {FIELD-SHIP-FIRST-NAME}
Shipping Last Name {FIELD-SHIP-LAST-NAME}
Shipping Address Line 1 {FIELD-SHIP-ADDRESS-1}
Shipping City {FIELD-SHIP-CITY}
Shipping State
Only required if the selected country has states or provinces.
{FIELD-SHIP-STATE}
Shipping Zip
Only required if the selected country has zip or postal codes.
{FIELD-SHIP-ZIP}
Shipping Country {FIELD-SHIP-COUNTRY}


Approach 1: Removing Undesired Fields
Any of the fields above are only required if they are present on the page. Therefore, it is possible to simply remove any of these fields that you don't want to use from the page's template.

collecting only name and phone number
For example, if you only want to collect the customer's first name and phone number, then all of the QuickCode Tags except {FIELD-BILL-FIRST-NAME} and {FIELD-PHONE-NUMBER} could be removed from the page's template.

Only the fields that are still present on the page will be required.
The removed ones won't be required anymore.


Approach 2: Making Fields Optional
Any of the fields above can also be made optional by including a parameter of "optional" in the instance of the QuickCode Tag in the template.

making the last name field optional
For example, to make the Billing Last Name field optional, the version of its QuickCode Tag would look like this:

{FIELD-BILL-LAST-NAME:optional}

This approach allows you to keep the fields on the page, so that they can be completed by the user if desired, but keeping them blank will now be allowed.
 
Variation on the Rule: PASSWORD FIELDS

A variation on the rule is Password fields. Password fields are optional by default. This is to allow customers to checkout without forcing them to create an account that they can log in to. If the password fields are completed, then an account area will be created for the customer. If left blank, one won't be.

related article
See the Introduction to Customer Accounts article for more info on how customer accounts are created and managed by the system.

The QuickCode Tags that create Password fields are:

Field QuickCode Tag
Password {FIELD-PASSWORD}
Confirm Password {FIELD-PASSWORD-CONFIRM}


Just like the other fields listed above, Password fields can be ignored completely by removing them from the page. If they are removed completely, then the system will treat the submitted data the same as if the password fields were just left blank.

Making Password Fields Required
The password fields above can be changed to become required by including a parameter of "required" in the instance of the QuickCode Tag in the template.

required password fields
For example, to make the password fields required, the version of their QuickCode Tags would look like this:

{FIELD-PASSWORD:required}
{FIELD-PASSWORD-CONFIRM:required}

If set to required, then the password fields will be treated like any of the other required fields listed above; the customer will be required to complete the fields if they are present on the page.
 
Exception to the Rule: EMAIL FIELDS

The email address fields cannot be made optional.
Also, the email field is the only field that cannot be removed from the checkout page.

This is because every customer account must have, at a minimum, an email address. If an email address is not submitted on the checkout page, then the system will neither be able to create an account record for that customer, nor process their order.

The QuickCode Tags that create Email fields are:

Field QuickCode Tag
Email {FIELD-EMAIL}
Confirm Email {FIELD-EMAIL-CONFIRM}

If either the "required" or "optional" parameter is added to either of the email field QuickCode Tags above, that parameter will be ignored.

By using the concepts introduced above, it is possible to customize what information is presented and collected on your store's checkout page. It is possible to either remove fields that you don't need completely, or make them optional so that the customer only needs to complete them if they so desire.
Powered by ModularKB